2 Replies Latest reply on Mar 25, 2012 3:34 PM by jerry98225

    Access of undefined property (loader)

    jerry98225 Level 1

      I am trying to run the simple code as following:

       

       

      <fx:Script>

      <![CDATA[

       

                                    import flash.display.*;

                                    import flash.net.URLRequest;

       

       

                                    Security.allowDomain("www.youtube.com");

                                    var url2:String = "image2.jpg";

                                    var urlRequest:URLRequest = new URLRequest(url2);   //problem code

                                    var loader:Loader = new Loader();     //problem code

                                    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_complete);   //problem code

                                    loader.load(urlRequest);

                                    addChild(loader);

       

                                    function loader_complete(evt:Event):void {

                                              var target_mc:Loader = evt.currentTarget.loader as Loader;

                                              target_mc.x = (stage.stageWidth - target_mc.width) / 2;

                                              target_mc.y = (stage.stageHeight - target_mc.height) / 2;

                                    }

                          ]]>

                </fx:Script>

       

       

      However, I got errors saying

       

       

          'access of undefined property 'loader_complete'

          'access of undefined property 'loader'

          'access of undefined property 'loader'

          'access of undefined property 'loader'

          'access of undefined property 'urlReguest'

       

       

       

       

      I haven't used Flash builder for a while and need some assistants. Any thoughts? Thanks for the help.