Hallo,
I have a FlashDevelop Project with as3 Code which i am currently trying to convert to c#. I have no experience with as3 but a lot with c#. I am studying the as3 code for weeks now (and already translated the vast bulk of the as3 code to c#), but there is one thing i just can't understand. That just makes no sense, but it works and i don't know why.
That code is in the constructor of the class. The Array "this.bytes()" is a embeded swf file.
Code:
this.swf = new Loader();
this.swf.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onSWFReady);
var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
loaderContext.allowCodeImport = true;
this.swf.loadBytes(new this.bytes(), loaderContext);
this.swf.y = 1200;
In the method "onSWFReady":
Code:
//some code that generates a bitmap with 32x1 pixel
...
var dmf:DisplacementMapFilter = new DisplacementMapFilter();
dmf.mapBitmap = bitmap;
this.swf.content.filters = [dmf];
this.swf.content.x = 1;
this.swf.addEventListener(Event.ENTER_FRAME,this.onFiltersReady);
In the method "onFiltersReady":
Code:
this.swf.content.filters = null;
this.swf.removeEventListener(Event.ENTER_FRAME,this.onURLBuilt);
var img:BitmapData = new BitmapData(500,8,false);
img.draw(this.swf.content);
I have the following problems:
If i delete the line "this.swf.content.filters = [dmf];" the first 160x1 pixel of the image img changes. But the property "scaleX" and "scaleY" of the filter dmf are 0.
According to this: http://help.adobe.com/en_US/FlashPla...MapFilter.html
The image should not change at all if "scaleX" and "scaleY" are 0.
Even if "scaleX" and "scaleY" would not be 0, how is it possible that the first 160x1 pixel of the image changes while bitmap only has a size of 32x1 pixel??
And why are the filters set to null before the image img is drawn?
Maybe someone can explain that to me.
Thanks
Willy