Quantcast
Viewing all articles
Browse latest Browse all 70427

Output Errors

I am hoping someone can help me. I am getting these errors except eveything seems to be defined. Please let me know if I overlooked something or what I am doing wrong thankyou.

 

 

 

Code

 

package info.mixnwithmarissa.cakecreater {

 

          import flash.display.MovieClip;

          import flash.events.Event;

          import flash.events.MouseEvent;

          import flash.net.URLRequest;

          import flash.net.URLLoader;

          import flash.events.IOErrorEvent;

          import flash.events.ProgressEvent;

          import flash.display.Loader;

          public class Main extends MovieClip {

 

                    private var intro:MovieClip;

                    private var startt:MovieClip;

                    private var setting:MovieClip;

                    //private var game:MovieClip;

                    private var currentState:String;

 

                    private var xmlURL:URLRequest;

                    private var xmlLdr:URLLoader;

                    private var imgURL:URLRequest;

                    private var imgLdr:Loader;

                    private var swfURL:URLRequest;

                    private var swfLdr:Loader;

                    public var xmlObj:XML;

                    private var loaderDisplay:MovieClip;

 

                    public var mainXML:XML;

 

 

 

                              public function Main() {

 

                              xmlURL = new URLRequest("xml/Appxml.xml")

                              xmlLdr = new URLLoader();

 

                              xmlLdr.addEventListener(Event.COMPLETE,onXMLLoaded);

                              xmlLdr.addEventListener(IOErrorEvent.IO_ERROR,onIOErro r);

 

                              xmlLdr.load(xmlURL);

                              }

                              private function onXMLLoaded(evt:Event):void{

 

                              mainXML = new XML( xmlLdr.data);

 

                              //trace(mainXML);

                              //E4X (ECMA for XML) uses dot syntax to "drill down" to child elements and the @ to access attribute data, and [] to access by element index.

                              //trace(mainXML.theme.music.@src);

 

                              //trace("background image: "+mainXML.theme.@bg);

                                          //trace("theme music: "+mainXML.theme.@music);

                                          imgURL = new URLRequest(mainXML.theme.@bg);

                                          imgLdr = new Loader();

                                          //Note: Loader objects are display objects, so they must be added to the display list

                                          addChild(imgLdr);

                                          imgLdr.contentLoaderInfo.addEventListener(Event.COMPLETE,onImgLoaded) ;

                                          imgLdr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,onIm gLoadProgress);

                                          imgLdr.load(imgURL);

                                          loaderDisplay = new ProgBar();

                                          addChild(loaderDisplay);

                                          //position

                                          loaderDisplay.x = 120;

                                          loaderDisplay.y = 200;

                                         

                                          swfURL = new URLRequest(xmlObj.theme.@anim);

                                          swfLdr = new Loader();

                                          //could add below existing onjects to apear beneath them

                                          addChildAt(swfLdr,0);

                                          swfLdr.load(swfURL);

 

                              intro = new Intro();

                              this.addChild(intro);

 

 

                              currentState = "intro";

                       }

                      

                       private function onImgLoadProgress(evt:ProgressEvent):void{

                              //trace("Load progress!");

                              //trace(imgLdr.contentLoaderInfo.bytesLoaded);

                              var loaded:Number = imgLdr.contentLoaderInfo.bytesLoaded;

                              var total:Number = imgLdr.contentLoaderInfo.bytesTotal;

                              var percent:Number = Math.round(loaded/total*100);

                              loaderDisplay.percentField.text = percent;

                              loaderDisplay.gotoAndStop(percent);

                              loaderDisplay.gotoAndStop(percent);

                              //trace("Percent Loaded = "(Math.round(loaded/total*100))+"%");

                    }

 

                    private function onImgLoaded(evt:Event):void{

                              //trace("Image loaded!");

 

                              removeChild(loaderDisplay);

 

                              imgLdr.x = 20;

                              imgLdr.y = 20;

                              imgLdr.width = 200;

 

                              //solve for new height maintaining aspect ration (so it doesn't look streched)

                              var origW:Number = imgLdr.contentLoaderInfo.width;

                              var origH:Number = imgLdr.contentLoaderInfo.height;

                              var newHeight:Number = origH*200/origW;

 

                              imgLdr.height= newHeight;

 

                              //could centre it too

                              imgLdr.y = stage.stageHeight/2-imgLdr.height/2;

 

 

                      

                    }

 

                              private function onIOError(evt:IOErrorEvent):void{

                                        //trace("XML loading error!!!");

                              }

 

                              public function changeState(newState:String):void{

 

 

                              switch(currentState){

                                        case "intro":

                                                  removeChild(intro);

                                                  break;

                                        case "start":

                                                  removeChild(startt);

                                                  break;

 

                                                  case "setting":

                                                  removeChild(setting);

                                                  break;

 

                                                  //case "game":

//                                                  game = new Game();

//                                                  removeChild(game);

//                                                  break;

 

 

                              }

 

                              switch(newState){

                                        case "intro":

                                                  intro = new Intro();

                                                  addChild(intro);

                                                  break;

 

                                        case "start":

                                                  startt = new Startt();

                                                  addChild(startt);

                                                  break;

 

                                        case "setting":

                                                  setting = new Setting();

                                                  addChild(setting);

                                                  break;

 

                                        //case "game":

//                                                  game = new Game();

//                                                  addChild(game);

//                                                  break;

 

                              }

                              currentState = newState;

                    }

          }

}

 

 

 

 

 

 

Output Errors

 

TypeError: Error #1009: Cannot access a property or method of a null object reference.

          at info.mixnwithmarissa.cakecreater::Main/onXMLLoaded()

          at flash.events::EventDispatcher/dispatchEventFunction()

          at flash.events::EventDispatcher/dispatchEvent()

          at flash.net::URLLoader/onComplete()

TypeError: Error #1010: A term is undefined and has no properties.

          at info.mixnwithmarissa.cakecreater::Main/onImgLoadProgress()

TypeError: Error #1010: A term is undefined and has no properties.

          at info.mixnwithmarissa.cakecreater::Main/onImgLoadProgress()

TypeError: Error #1010: A term is undefined and has no properties.

          at info.mixnwithmarissa.cakecreater::Main/onImgLoadProgress()


Viewing all articles
Browse latest Browse all 70427

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>