fixes
This commit is contained in:
@@ -60,4 +60,6 @@ interface IView<C:Content> {
|
|||||||
|
|
||||||
public function update():Void;
|
public function update():Void;
|
||||||
public function invalidate():Void;
|
public function invalidate():Void;
|
||||||
|
|
||||||
|
public function remove():Void;
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,15 @@ class MovieView extends View<MovieClip> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function set_movie(value:MovieClip):MovieClip {
|
private function set_movie(value:MovieClip):MovieClip {
|
||||||
|
var index:Int = 0;
|
||||||
|
if (parent != null && content != null) {
|
||||||
|
index = parent.content.getChildIndex(content);
|
||||||
|
parent.content.removeChild(content);
|
||||||
|
}
|
||||||
content = value;
|
content = value;
|
||||||
|
if (parent != null) {
|
||||||
|
parent.content.addChildAt(content, index);
|
||||||
|
}
|
||||||
invalidate();
|
invalidate();
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,6 +95,10 @@ class View<C:Content> implements IView<C> {
|
|||||||
if (skin != null) skin.draw(this);
|
if (skin != null) skin.draw(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function remove():Void {
|
||||||
|
if (parent != null) parent.removeView(this);
|
||||||
|
}
|
||||||
|
|
||||||
private function set_x(value:Float):Float {
|
private function set_x(value:Float):Float {
|
||||||
if (x != value) {
|
if (x != value) {
|
||||||
x = value;
|
x = value;
|
||||||
|
|||||||
@@ -118,8 +118,9 @@ class ListView<V:IView<Dynamic>, D> extends GroupView implements ScrollListener
|
|||||||
|
|
||||||
public function onScroll(position:Float):Void {
|
public function onScroll(position:Float):Void {
|
||||||
var x:Float = filteredData.length * position;
|
var x:Float = filteredData.length * position;
|
||||||
offset = Math.round(x) - 1;
|
var o:Int = Math.floor(x);
|
||||||
offsetDiff = (x - offset);
|
offsetDiff = (x - o);
|
||||||
|
offset = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function onMouseWheelEvent(event:MouseEvent):Void {
|
private function onMouseWheelEvent(event:MouseEvent):Void {
|
||||||
@@ -135,7 +136,7 @@ class ListView<V:IView<Dynamic>, D> extends GroupView implements ScrollListener
|
|||||||
if (filteredData != null) {
|
if (filteredData != null) {
|
||||||
//ToDo: constant for 2
|
//ToDo: constant for 2
|
||||||
if (value == 0) offsetDiff = 0;
|
if (value == 0) offsetDiff = 0;
|
||||||
if (value == filteredData.length - size + 2) offsetDiff = 3 - sizeDiff;
|
if (value == filteredData.length - size + 2) offsetDiff = sizeDiff - 2;
|
||||||
}
|
}
|
||||||
offset = value;
|
offset = value;
|
||||||
render();
|
render();
|
||||||
@@ -175,7 +176,7 @@ class ListView<V:IView<Dynamic>, D> extends GroupView implements ScrollListener
|
|||||||
if (data != null && renderer != null) {
|
if (data != null && renderer != null) {
|
||||||
filteredData = filter == null ? data : data.filter(filter);
|
filteredData = filter == null ? data : data.filter(filter);
|
||||||
scroll.ratio = Math.min(1.0, (size - sizeDiff) / filteredData.length);
|
scroll.ratio = Math.min(1.0, (size - sizeDiff) / filteredData.length);
|
||||||
scroll.position = (offset / filteredData.length);
|
scroll.position = ((offset + offsetDiff) / filteredData.length);
|
||||||
for (i in 0...size) {
|
for (i in 0...size) {
|
||||||
var item:ListItem<V, D> = items[i];
|
var item:ListItem<V, D> = items[i];
|
||||||
item.index = offset + i;
|
item.index = offset + i;
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ class BaseMediaLoader<T> extends BaseLoader<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function buildLoaderContext(bytes:Bool):LoaderContext {
|
private function buildLoaderContext(bytes:Bool):LoaderContext {
|
||||||
|
#if flash
|
||||||
return switch (Security.sandboxType) {
|
return switch (Security.sandboxType) {
|
||||||
case Security.REMOTE:
|
case Security.REMOTE:
|
||||||
//null;
|
//null;
|
||||||
@@ -63,6 +64,9 @@ class BaseMediaLoader<T> extends BaseLoader<T> {
|
|||||||
default:
|
default:
|
||||||
null;
|
null;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
return null;
|
||||||
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildLoader():Loader {
|
private function buildLoader():Loader {
|
||||||
@@ -83,7 +87,7 @@ class BaseMediaLoader<T> extends BaseLoader<T> {
|
|||||||
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onError);
|
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onError);
|
||||||
loader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, onError);
|
loader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, onError);
|
||||||
loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
|
loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
|
||||||
try { loader.close(); } catch (error:Dynamic) {}
|
#if flash try { loader.close(); } catch (error:Dynamic) {} #end
|
||||||
loader = null;
|
loader = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user