Question : Flex Passing parameter to a class + loader external jpg

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onAppInit()" backgroundColor="#3f3f3f" xmlns:controls="com.fxcomponents.controls.*"  applicationComplete="init()"  width="751" height="199"> 
<mx:Script> 
<![CDATA[ 
	import mx.controls.Alert;
	import mylib.imgView;
	import mylib.test1;
	
	//static public var abc1:imgView = new imgView ();
	
	public function onAppInit():void { 
		Security.allowDomain("http://blog.minidx.com/"); 
	} 
	
	public function init():void {   
        
        var obj:Object = stage.loaderInfo.parameters;
        var abc1:imgView = new imgView('img_path');

    } 
]]> 
</mx:Script> 


1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
// ActionScript file (imgView.as) 
package mylib { 
	import flash.display.Loader; 
	import flash.events.Event; 
	import flash.net.URLRequest; 
	import mx.core.UIComponent; 
  
	public class imgView extends UIComponent { 
		//private const image_path:String = ""; 
		private var loader:Loader; 
		private var request:URLRequest; 
		public var test:String = 'test';
		//private var image_path:String;
		  
		public function imgView() { 
			//this.image_path = image_path;
			loader=new Loader(); 
			request = new URLRequest(img_path); 
			
			//loader.contentLoaderInfo.addEventListener(Event.INIT,onComplete); 
			loader.load(request); 
                        addChild(loader); 
		    
		} 
		
		/*private function onComplete(event:Event):void { 
			addChild(loader); 
		} */
		

				
	} 
}
</mx:Application>


i want to call the class imgView and load the image to the stage when the class init, but the above code got error...
anyone can help? thank!

Answer : Flex Passing parameter to a class + loader external jpg

Random Solutions  
 
programming4us programming4us