Action Script Sprite unusual behaviour

3 views
Skip to first unread message

A

unread,
May 5, 2012, 3:10:08 AM5/5/12
to Flex India Community
Hi Guys,

do you see any issue with this program, i get a blank screen when i
execute this .
not sure what is wrong in it .


package {
import flash.display.Sprite;
import flash.geom.Matrix;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.display.BitmapData;
import flash.events.Event;
public class Drawing extends Sprite {
private var _loader:Loader;
public function Drawing( ) {
_loader = new Loader( );
_loader.load(new URLRequest("http://www.rightactionscript.com/
samplefiles/image2.jpg"));
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onImageLoad);
}
private function onImageLoad(event:Event):void {
var bitmap:BitmapData = new BitmapData(_loader.width,
_loader.height);
bitmap.draw(_loader, new Matrix( ));
var matrix:Matrix = new Matrix( );
matrix.scale(.1, .1);
var sampleSprite:Sprite = new Sprite( );
sampleSprite.graphics.lineStyle( );
sampleSprite.graphics.beginBitmapFill(bitmap, matrix);
sampleSprite.graphics.drawCircle(100, 100, 100);
sampleSprite.graphics.endFill( );
addChild(sampleSprite);
}
}
}

Veena Chezhian

unread,
May 22, 2012, 3:28:07 PM5/22/12
to flex_...@googlegroups.com
try to add one error event listener and see if there is any error . 

 _loader.contentLoaderInfo.addEventListener( IOErrorEvent.IO_ERROR, errorHandler); 
 _loader.contentLoaderInfo.addEventListener( SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); 



--
You received this message because you are subscribed to the Google Groups "Flex India Community" group.
To post to this group, send email to flex_...@googlegroups.com.
To unsubscribe from this group, send email to flex_india+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.


Reply all
Reply to author
Forward
0 new messages