MovieClip(parent).function throws error TypeError: Error #1034:

The error says there is a forced conversion of a loader to a movieclip.
I am using a container movie main.swf to load a child movie. The child movie tries to access a variable and a function in main.swf
child.swf contains:
import flash.display.Loader;
import flash.display.MovieClip;
import flash.events.Event;
MovieClip(parent).traceF;
MovieClip(parent).globalVar;
The loader Main movie is movie.swf which has its code in a Main.as doc
package
import flash.display.Loader;
import flash.display.MovieClip;
import flash.net.URLRequest;
import flash.events.ProgressEvent;
import flash.events.Event;
public class Main extends MovieClip
public var globalVar:String = "global";
public var myLoader:Loader = new Loader ();
public function Main()
this.addEventListener(Event.ADDED_TO_STAGE,init);
private function init(e:Event):void
loadFile("child.swf");
private function loadFile(path:String):void
var myRequest:URLRequest = new URLRequest(path);
myLoader.load(myRequest);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
private function loadProgress(evt:ProgressEvent):void
var amountLoaded:Number = (evt.bytesLoaded / evt.bytesTotal)*100;
trace("Loading: % " + amountLoaded);
private function loadComplete(evt:Event):void
trace("Complete - " + evt.target.content);
addChild(myLoader);
public function traceF ()
trace(globalVar);

If you are loading the swf into another swf using the Loader class, the Loader is the parent of the loaded file.  The parent of the Loader is the main swf you are probably after... MovieClip(parent.parent) from the loaded file's perspective.

Similar Messages

  • TypeError: Error #1006: getInstance is not a function.

    I having some problems implementing Flex for the first time.
    At the moment I'm getting
    TypeError: Error #1006: getInstance is not a function.
    I suspect that I'm missing a library or something in the
    compile but I don't know how to resolve it.
    When I Run the Application in Flex Builder I get an error
    that the file isn't in the project and that some of the features
    are disabled. This would be consistent with an incomplete compile
    but the file is in a project. I even recreated a new project but I
    get the same errors.
    What am I missing?

    More detail on the error:
    TypeError: Error #1006: getInstance is not a function.
    at mx.core::Singleton$/getInstance()
    at mx.styles::StyleManager$cinit()
    at global$init()
    at mx.containers::Form$cinit()
    at global$init()
    at global$init()
    In debug it was stopping here in Singleton.as
    public static function getInstance(name:String):Object
    var clazz:Class = classMap[name];
    return Object(clazz).getInstance();
    I changed the container from mx:Form to mx:Application so now
    it seems to be working, but I'm not sure why mx:Form was giving me
    this issue.

  • Flash CS4 - Images in gallery will not show- TypeError: Error #1034: Type Coercion failed: cannot co

    So for my A2 studies I have to make an interactive product using flash. Long story short, I needed to make a flash gallery. I am using the "Zen Gallery Flash Component" and this is my code;
    galleryInstance.albums=[                                                             {                                                                         imagesFolder:"N:\ICT\ICT Unit 10\Prototype 3\images",                                                                       icon:"4.jpg",                                                                       items:                                                                       [                                                                                 {source:"1.jpg"},                                                                                 {source:"2.png"},                                                                                 {source:"3.jpg"},                                                                                 {source:"4.jpg"},                                                                                 {source:"5.jpg"}                                                                       ]                                                             },                                                             {                                                                       imagesFolder:"N:\ICT\ICT Unit 10\Prototype 3\images",                                                                       icon:"8.jpg",                                                                       items:                                                                       [                                                                                 {source:"6.png"},                                                                                 {source:"7.jpg"},                                                                                 {source:"8.jpg"},                                                                                 {source:"9.jpg"},                                                                                 {source:"10.jpg"}                                                                       ]                                                             }                                                             ]; galleryInstance.build(); 
    The user manual does not specify any more coding is needed (I read all the relevant parts and couldn't find anything). The problem is that my images do not show but when exporting the flash product, the gallery is fully functionon - it seems that it cannot locate my images.
    In addition to this, I get multiple Output Errors;
    TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::IOErrorEvent@2d09a709 to Error. TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::IOErrorEvent@2d09a709 to Error. TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::IOErrorEvent@2d09a709 to Error.etc..
    What am I doing wrong?

    I'm not sure, the gallery just appeares to be an SWF.
    This is all that came up when I clicked it (I had a look at the parameters and they don't seem to help in the addition of pictures).
    There appears to be no forum for this flash component :L

  • TypeError: Error #1009 A.S 3.0

    Sorry i am bad in English...In this case, I'm still new.I have this error
    "TypeError: Error #1009: Cannot access a property or method of a null object reference. at Monster/hurtPlayer() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at fl.motion::AnimatorBase/end() at fl.motion::AnimatorBase/handleLastFrame()
    This my code:  
    var monstersInGame:uint;
    var monsterMaker:Timer;
    var container_mc:MovieClip;
    var cursor:MovieClip;
    var winning:wins = new wins();
    var gameovers:gameover = new gameover();
    var livecherep:liveimg = new liveimg();
    var score:int;  var energy:int;
    var live:Number =3;
    var myTimer2:Timer;
    var myTimer3:Timer;
    var monster:MovieClip; function startlevel(); {container_mc = new MovieClip(); addChild(container_mc);  energy = energy_mc.totalFrames; energy_mc.gotoAndStop(energy); if(live==3){     lives.gotoAndStop(3);} if(live==2){     lives.gotoAndStop(2);} if(live==1){     lives.gotoAndStop(1);} monstersInGame = 8;     monsterMaker = new Timer(1000,monstersInGame); monsterMaker.addEventListener(TimerEvent.TIMER, createMonsters); monsterMaker.start(); cursor = new Cursor();      addChild(cursor);                     Mouse.hide ();          stage.addEventListener(MouseEvent.MOUSE_MOVE, dragCursor);          score = 0;         }   function dragCursor(event:MouseEvent):void   {      cursor.x = this.mouseX; cursor.y = this.mouseY; }  function createMonsters(event:TimerEvent):void   {         monster = new Monster();     monster.x = Math.random() * stage.stageWidth;     if (monster.x <= 100) {       monster.x = 100;    }   else if (monster.x >= 380) {    monster.x = 350;   }     monster.y = Math.random() * stage.stageHeight;     if (monster.y <= 100)     {       monster.y = 100;      }   else if (monster.y >= 380)   {    monster.y = 350;   }      container_mc.addChild(monster);     }   function nextf(event:TimerEvent) // timer for winning   {  myTimer2.removeEventListener(TimerEvent.TIMER_COMPLETE,nextf);   removeChild(winning)   gotoAndStop(4);  }   function nextm(event:TimerEvent) // timer for gameover   {  myTimer3.removeEventListener(TimerEvent.TIMER_COMPLETE,nextm); removeChild(gameovers)   gotoAndStop(13);      }        function increaseScore():void //if win  { score ++; if(score >= 6)  {  monsterMaker.stop();     removeChild(container_mc);     removeChild(cursor)         stage.removeEventListener(MouseEvent.MOUSE_MOVE, dragCursor);                  addChild(winning)          myTimer5 = new Timer(1000,1); myTimer5.addEventListener(TimerEvent.TIMER_COMPLETE,nextf);  myTimer5.start();                 } }  function decreaseEnergy():void // if lose  { energy --; if(energy==4){     energy_mc.gotoAndStop(4);}     if(energy==3){     energy_mc.gotoAndStop(3);}     if (energy==2){     energy_mc.gotoAndStop(2);}      if(energy==1){     energy_mc.gotoAndStop(1);}      if(energy==0){     energy_mc.gotoAndStop(1);}            if(energy <= 1) { live--;         monsterMaker.stop();     removeChild(container_mc);     removeChild(cursor)                 Mouse.show();      stage.removeEventListener(MouseEvent.MOUSE_MOVE, dragCursor);         if (live==0)  { addChild(gameovers)   myTimer6 = new Timer(1500,1); myTimer6.addEventListener(TimerEvent.TIMER_COMPLETE,nextm);  myTimer6.start(); }         else {     gotoAndStop(9);     } } } [/HIGHLIGHT]  but this code i am have in MovieClip monster :  [HIGHLIGHT] import fl.motion.Animator;  import fl.motion.MotionEvent; var this_xml:XML =
                                                                                                                                                                          ;  var this_animator:Animator = new Animator(this_xml, this);  this_animator.play();  this_animator.addEventListener(MotionEvent.MOTION_END, hurtPlayer);  function hurtPlayer (Event:MotionEvent): void  {          var main:MovieClip = MovieClip(this.parent.parent);              main.decreaseEnergy();          this.parent.removeChild(this); }  this.addEventListener(MouseEvent.CLICK, killMonster);  function killMonster(event:MouseEvent):void  { gotoAndPlay(31) ; this_animator = new Animator(this_xml, this);  this_animator.play(); this_animator.addEventListener(MotionEvent.MOTION_END, die); } function die(event:MotionEvent):void  {     var main:MovieClip = MovieClip(this.parent.parent);     main.increaseScore();         this_animator.removeEventListener(MotionEvent.MOTION_END, hurtPlayer) this.parent.removeChild(this); }   [/HIGHLIGHT]
    As I understand it, the error is in the function hurtPlayer at monster movieclip .I am ran Debug movie, showed on main.decreaseEnergy(); in hurtPlayer function.Please help me.Thanks.

    This code i have in mine timeline first frame:
    var monstersInGame:uint;
    var monsterMaker:Timer;
    var container_mc:MovieClip;
    var cursor:MovieClip;
    var winning:wins = new wins();
    var gameovers:gameover = new gameover();
    var livecherep:liveimg = new liveimg();
    var score:int;
    var energy:int;
    var live:Number =3;
    var myTimer2:Timer;
    var myTimer3:Timer;
    var monster:MovieClip;
    function startlevel();
    container_mc = new MovieClip();
    addChild(container_mc);
    energy = energy_mc.totalFrames;
    energy_mc.gotoAndStop(energy);
    if(live==3){     lives.gotoAndStop(3);}
    if(live==2){     lives.gotoAndStop(2);}
    if(live==1){     lives.gotoAndStop(1);}
    monstersInGame = 8;
    monsterMaker = new Timer(1000,monstersInGame);
    monsterMaker.addEventListener(TimerEvent.TIMER, createMonsters);
    monsterMaker.start();
    cursor = new Cursor();
    addChild(cursor);
    Mouse.hide ();
    stage.addEventListener(MouseEvent.MOUSE_MOVE, dragCursor);
    score = 0; 
    function dragCursor(event:MouseEvent):void
    cursor.x = this.mouseX;
    function createMonsters(event:TimerEvent):void
    monster = new Monster();
    monster.x = Math.random() * stage.stageWidth;
    if (monster.x <= 100)
    monster.x = 100;
    else if (monster.x >= 380)
    monster.x = 350;
    monster.y = Math.random() * stage.stageHeight;
    if (monster.y <= 100)
    monster.y = 100;
    else if (monster.y >= 380)
    monster.y = 350;
    container_mc.addChild(monster);
    function nextf(event:TimerEvent) // timer for winning
    myTimer2.removeEventListener(TimerEvent.TIMER_COMPLETE,nextf);
    removeChild(winning)   gotoAndStop(4);
    function nextm(event:TimerEvent) // timer for gameover
    myTimer3.removeEventListener(TimerEvent.TIMER_COMPLETE,nextm);
    removeChild(gameovers)
    gotoAndStop(13);
    function increaseScore():void //if win
    score ++;
    if(score >= 6)
    monsterMaker.stop();
    removeChild(container_mc);
    removeChild(cursor)  
    stage.removeEventListener(MouseEvent.MOUSE_MOVE, dragCursor);         
    addChild(winning)  
    myTimer5 = new Timer(1000,1);
    myTimer5.addEventListener(TimerEvent.TIMER_COMPLETE,nextf);
    myTimer5.start();         
    function decreaseEnergy():void //if lose
    energy --;
    if(energy==4){     energy_mc.gotoAndStop(4);}
    if(energy==3){     energy_mc.gotoAndStop(3);}
    if (energy==2){     energy_mc.gotoAndStop(2);}
    if(energy==1){     energy_mc.gotoAndStop(1);}
    if(energy==0){     energy_mc.gotoAndStop(1);}      
    if(energy <= 1)
    live--;  
    monsterMaker.stop();
    removeChild(container_mc);
    removeChild(cursor)          
    Mouse.show();
    stage.removeEventListener(MouseEvent.MOUSE_MOVE, dragCursor);  
    if (live==0)
    addChild(gameovers)
    myTimer6 = new Timer(1500,1); myTimer6.addEventListener(TimerEvent.TIMER_COMPLETE,nextm);
    myTimer6.start();
    else
    gotoAndStop(9);
    This code i have in MovieClip monster:
    import fl.motion.Animator;
    import fl.motion.MotionEvent;
    var this_xml:XML =   HERE I inserted the classic tween code with the instance name "this" to use in the ActionScript
    Sorry i am cant insert there this classic tween code
    var this_animator:Animator = new Animator(this_xml, this);
    this_animator.play();
    this_animator.addEventListener(MotionEvent.MOTION_END, hurtPlayer);
    function hurtPlayer (Event:MotionEvent): void
    var main:MovieClip = MovieClip(this.parent.parent);
    main.decreasyEnergy(); in this line i am have error
    "TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Monster/hurtPlayer()[Monster::frame1:35]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at fl.motion::AnimatorBase/end()
    at fl.motion::AnimatorBase/handleLastFrame()
    at fl.motion::AnimatorBase/nextFrame()
    at fl.motion::AnimatorBase/handleEnterFrame()"
    this.parent.removeChild(this);
    this.addEventListener(MouseEvent.CLICK, killMonster);
    function killMonster(event:MouseEvent):void
    gotoAndPlay(31)
    this_animator = new Animator(this_xml, this);
    this_animator.play();
    this_animator.addEventListener(MotionEvent.MOTION_END, die);
    function die(event:MotionEvent):void
    var main:MovieClip = MovieClip(this.parent.parent);
    main.increaseScore();
    this_animator.removeEventListener(MotionEvent.MOTION_END, hurtPlayer);
    this.parent.removeChild(this);

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

    Hi all,
    I am new to ActionScript and Flash, and I am getting this error: TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at jessicaclucas_fla::MainTimeline/stopResumescroll()
    I have several different clips in one movie that have scrolling content. When I click a button to move to a different clip that doesn’t have a certain scroll, it gives me this error. I cannot figure out how to fix this. You can see the site I am working on: http://www.jessicaclucas.com. I would really appreciate some help! Thank you in advance. Here is the code:
    //Import TweenMax and the plugin for the blur filter
    import gs.TweenMax;
    import gs.plugins.BlurFilterPlugin;
    //Save the content’s and mask’s height.
    //Assign your own content height here!!
    var RESUMECONTENT_HEIGHT:Number = 1500;
    var RESUME_HEIGHT:Number = 450;
    //We want to know what was the previous y coordinate of the content (for the animation)
    var oldResumeY:Number = myResumecontent.y;
    //Position the content on the top left corner of the mask
    myResumecontent.x = myResume.x;
    myResumecontent.y = myResume.y;
    //Set the mask to our content
    myResumecontent.mask = myResume;
    //Create a rectangle that will act as the Resumebounds to the scrollMC.
    //This way the scrollMC can only be dragged along the line.
    var Resumebounds:Rectangle = new Rectangle(resumescrollMC.x,resumescrollMC.y,0,450);
    //We want to know when the user is Resumescrolling
    var Resumescrolling:Boolean = false;
    //Listen when the user is holding the mouse down on the scrollMC
    resumescrollMC.addEventListener(MouseEvent.MOUSE_DOWN, startResumescroll);
    //Listen when the user releases the mouse button
    stage.addEventListener(MouseEvent.MOUSE_UP, stopResumescroll);
    //This function is called when the user is dragging the scrollMC
    function startResumescroll(e:Event):void {
    //Set Resumescrolling to true
    Resumescrolling = true;
    //Start dragging the scrollMC
    resumescrollMC.startDrag(false,Resumebounds);
    //This function is called when the user stops dragging the scrollMC
    function stopResumescroll(e:Event):void {
    //Set Resumescrolling to false
    Resumescrolling = false;
    //Stop the drag
    resumescrollMC.stopDrag();
    //Add ENTER_FRAME to animate the scroll
    addEventListener(Event.ENTER_FRAME, enterResumeHandler);
    //This function is called in each frame
    function enterResumeHandler(e:Event):void {
    //Check if we are Resumescrolling
    if (Resumescrolling == true) {
    //Calculate the distance how far the scrollMC is from the top
    var distance:Number = Math.round(resumescrollMC.y - Resumebounds.y);
    //Calculate the percentage of the distance from the line height.
    //So when the scrollMC is on top, percentage is 0 and when its
    //at the bottom the percentage is 1.
    var percentage:Number = distance / RESUME_HEIGHT;
    //Save the old y coordinate
    oldResumeY = myResumecontent.y;
    //Calculate a new y target coordinate for the content.
    //We subtract the mask’s height from the contentHeight.
    //Otherwise the content would move too far up when we scroll down.
    //Remove the subraction to see for yourself!
    var targetY:Number = -((RESUMECONTENT_HEIGHT - RESUME_HEIGHT) * percentage) + myResume.y;
    //We only want to animate the scroll if the old y is different from the new y.
    //In our movie we animate the scroll if the difference is bigger than 5 pixels.
    if (Math.abs(oldResumeY - targetY) > 5) {
    //Tween the content to the new location.
    //Call the function ResumetweenFinished() when the tween is complete.
    TweenMax.to(myResumecontent, 0.3, {y: targetY, blurFilter:{blurX:22, blurY:22}, onComplete: ResumetweenFinished});
    //This function is called when the tween is finished
    function ResumetweenFinished():void {
    //Tween the content back to “normal” (= remove blur)
    TweenMax.to(myResumecontent, 0.3, {blurFilter:{blurX:0, blurY:0}});

    Hi again,
    Thank you for helping. I really appreciate it! Would it be easier to say, if resumescrollMC exists, then execute these functions? I was not able to figure out the null statement from your post. Here is what I am trying (though I am not sure it is possible). I declared the var resumescrollMC, and then I tried to put pretty much the entire code into an if (resumescrollMC == true) since this code only needs to be completed when resumescrollMC is on the stage. It is not working the way I have tried, but I am assuming I am setting up the code incorrectly. Or, an if statement is not supposed to be issued to an object:
    //Import TweenMax and the plugin for the blur filter
    import gs.TweenMax2;
    import gs.plugins.BlurFilterPlugin2;
    //Save the content's and mask's height.
    //Assign your own content height here!!
    var RESUMECONTENT_HEIGHT:Number = 1500;
    var RESUME_HEIGHT:Number = 450;
    var resumescrollMC:MovieClip;
    if (resumescrollMC == true) {
    //We want to know what was the previous y coordinate of the content (for the animation)
    var oldResumeY:Number = myResumecontent.y;
    //Position the content on the top left corner of the mask
    myResumecontent.x = myResume.x;
    myResumecontent.y = myResume.y;
    //Set the mask to our content
    myResumecontent.mask = myResume;
    //Create a rectangle that will act as the Resumebounds to the scrollMC.
    //This way the scrollMC can only be dragged along the line.
    var Resumebounds:Rectangle = new Rectangle(resumescrollMC.x,resumescrollMC.y,0,450);
    //We want to know when the user is Resumescrolling
    var Resumescrolling:Boolean = false;
    //Listen when the user is holding the mouse down on the scrollMC
    resumescrollMC.addEventListener(MouseEvent.MOUSE_DOWN, startResumescroll);
    //Listen when the user releases the mouse button
    stage.addEventListener(MouseEvent.MOUSE_UP, stopResumescroll);
    //This function is called when the user is dragging the scrollMC
    function startResumescroll(e:Event):void {
    //Set Resumescrolling to true
    Resumescrolling = true;
    //Start dragging the scrollMC
    resumescrollMC.startDrag(false,Resumebounds);
    //This function is called when the user stops dragging the scrollMC
    function stopResumescroll(e:Event):void {
    //Set Resumescrolling to false
    Resumescrolling = false;
    //Stop the drag
    resumescrollMC.stopDrag();
    //Add ENTER_FRAME to animate the scroll
    addEventListener(Event.ENTER_FRAME, enterResumeHandler);
    //This function is called in each frame
    function enterResumeHandler(e:Event):void {
    //Check if we are Resumescrolling
    if (Resumescrolling == true) {
    //Calculate the distance how far the scrollMC is from the top
    var distance:Number = Math.round(resumescrollMC.y - Resumebounds.y);
    //Calculate the percentage of the distance from the line height.
    //So when the scrollMC is on top, percentage is 0 and when its
    //at the bottom the percentage is 1.
    var percentage:Number = distance / RESUME_HEIGHT;
    //Save the old y coordinate
    oldResumeY = myResumecontent.y;
    //Calculate a new y target coordinate for the content.
    //We subtract the mask's height from the contentHeight.
    //Otherwise the content would move too far up when we scroll down.
    //Remove the subraction to see for yourself!
    var targetY:Number = -((RESUMECONTENT_HEIGHT - RESUME_HEIGHT) * percentage) + myResume.y;
    //We only want to animate the scroll if the old y is different from the new y.
    //In our movie we animate the scroll if the difference is bigger than 5 pixels.
    if (Math.abs(oldResumeY - targetY) > 5) {
    //Tween the content to the new location.
    //Call the function ResumetweenFinished() when the tween is complete.
    TweenMax.to(myResumecontent, 0.3, {y: targetY, blurFilter:{blurX:22, blurY:22}, onComplete: ResumetweenFinished});
    //This function is called when the tween is finished
    function ResumetweenFinished():void {
    //Tween the content back to "normal" (= remove blur)
    TweenMax.to(myResumecontent, 0.3, {blurFilter:{blurX:0, blurY:0}});

  • TypeError: Error #1009 - I know how to fix it. But I don't know whats going on!

    I have a project that I’m working on that includes working in different scenes and frames. It’s a book project with lots of pages (frames) and chapters (scenes) so I have can’t avoid working in a single frame (like a game). I get a runtime error (TypeError: Error #1009: Cannot access a property or method of a null object reference.) when accessing an object inside of a movieclip. However, I have identified the problem and know how to fix it. But when I fix it the functionality goes away. Here’s how it happens:
    On frame #1 of Scene 2 I click on a button to go to a frame #2.
    On frame #2 is the offending code:
         stage.addEventListener(MouseEvent.MOUSE_UP, moveChapters);
    //********************Navigation Bar code ********************//
    function moveChapters(event:MouseEvent):void
            if(event.target == bottomNav.Chapter_1)
            trace("Chapter #1 is working!");
    FYI, this code is part of a navigation bar the will take the user to different chapters. It is visible on stage. I haven't fully built it yet. For example, "if( event.target == bottomNav.Chapter_1)" will take the user to chapter 1, "bottomNav.Chapter_2," will take the user to chapter 2, so on and so forth. "bottomNav" is a movieclip and "Chapter_1" is a button inside it.
    When I go back to frame #1 of Scene 2 and then click on “Home” button to go back to the main page (Frame #1 of Scene #2) I get the Error #1009.
    When I comment out the “if(event.target == bottomNav.Chapter_1)” I don’t get the error but know I don’t have any functionality.
    Is there a better way to do this?

    Adding the event listener to the stage for this sort of functionality is a bad idea. Even though Flash can, apparently, resolve the objects inside the movieClip, you are making the connection between the object and the event that you want to capture more difficult than it should be. A better approach is to place all of the target objects into an array and then attach the event listener to each object in the array. Then you can easily extract the target from the event.
    Something like this might work for you:
    var chapterList:Array = new Array(bottomNav.Chapter_1,bottomNav.Chapter_2,bottomNav.Chapter_3);
    for(var i in chapterList) {
         chapterList[i].addEventListener(MouseEvent.MOUSE_UP,moveChapters);
    function moveChapters(event:MouseEvent):void {
         var thisChapter:Object = event.target;
               //  etc

  • TypeError: Error #1007: Instantiation attempted on a non-constructor.

    So I am trying out Flex 4 and started so by creating a basic class that extends the spark.components.Application class.
    package
        import spark.components.Application; 
        public class SimpleApp extends Application
            public function SimpleApp():void
                super();
    It compiles time but at runtime I am getting this error:
    TypeError: Error #1007: Instantiation attempted on a non-constructor.
    at mx.preloaders::Preloader/initialize()
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::initialize()
    at mx.managers::SystemManager/initHandler()
    Anyone have any insight into this? I found this http://forums.adobe.com/message/2724794 but it doesn't really seem to be a whole lot of help in my case.

    K so I just setup a simple mxml file for it
    <?xml version="1.0"?>
    <sa:SimpleApp xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:sa="com.simpleapp.*" />
    Now it seems to be happy. Thanks.

  • TypeError: Error #1010 on code that doesn't exist.

    Hello all,
    I have a drop down menu with 7 options. The menu is a movie clip with a mask that reveals each of the buttons when a person mouse_overs the menu button. Each menu option does the same thing, it will call a function based on the button clicked. The function for each button does the same thing:
    function INDEX_Safety (e:MouseEvent):void
              play();
              INDEX_SAFETY=true;
              Sound_Stopper ();
    Each of the functions will change the value of its respecive boolean variable. One for each button. Sound Stopper is a function that stops any FLV Sound that is currently playing.
    When it goes through play() it will come to a particular frame that has:
    Index_Jumper ();
    this function determines which boolean has been set to true, and does a gotoAndPlay("Label Name") based on the boolean that has been set to true. Then sets the boolean back to false.
    function Index_Jumper ():void
              if (INDEX_SAFETY==true){gotoAndPlay("Safety"); INDEX_SAFETY=false;}
              if (INDEX_TOOLS==true){gotoAndPlay("Tools and Positions"); INDEX_TOOLS=false;}
              if (INDEX_METHODS==true){gotoAndPlay("The Methods"); INDEX_METHODS=false;}
              if (INDEX_METHOD1==true){gotoAndPlay("Method 1"); INDEX_METHOD1=false;}
              if (INDEX_METHOD2==true){gotoAndPlay("Method 2"); INDEX_METHOD2=false;}
              if (INDEX_TDBL==true){gotoAndPlay("Installing TDBL"); INDEX_TDBL=false;}
              if (INDEX_RAISING==true){gotoAndPlay("Raising the Stand"); INDEX_RAISING=false;}
    The issue i am having: When i click on the 6th option, TDBL, i get the error:
    TypeError: Error #1010: A term is undefined and has no properties.
              at RaisingtheOperatorsPlatform_fla::MainTimeline/frame147()[RaisingtheOperatorsPlatform_fla. MainTimeline::frame147:10]
    It says frame 147:10
    From my understanding this means the 10th line on Frame 147.
    This is my frame 147:
    1. stop ();
    2. Caption ();
    3. IndexMC.Safety_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Safety);
    4. IndexMC.Tools_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Tools);
    5. IndexMC.Methods_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Methods);
    6. IndexMC.Method1_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Method1);
    7. IndexMC.Method2_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Method2);
    8. IndexMC.TBDL_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Tdbl);
    9. IndexMC.Raising_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Raising);
    I dont have a 10th line.
    also, when i click the 7th option, nothing happens. However, options 1 - 5 on the drop down menu work just fine.
    Thanks for any insight.

    Right after posting that, I got an idea to try adding the following to frame 1:
    addEventListener(Event.ENTER_FRAME, Frame_147);
    function Frame_147 (event:Event):void
              if (currentFrame==147)
                        stop ();
              Caption ();
              IndexMC.Safety_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Safety);
              IndexMC.Tools_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Tools);
              IndexMC.Methods_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Methods);
              IndexMC.Method1_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Method1);
              IndexMC.Method2_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Method2);
              IndexMC.TDBL_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Tdbl);
              IndexMC.Raising_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Raising);
    I then commented-out frame 147.
    the error i got pointed to line 36 of frame 1, which is:
      IndexMC.TDBL_Menu_Button.addEventListener(MouseEvent.CLICK, INDEX_Tdbl);
    Being able to focus on this, i see that i have IndexMC.TBDL instead of IndexMC.TDBL, i think this was one of those "been looking at this thing for too long" errors. Thank you for looking into this, the problem is now solved. As for the error pointing to a line that doesn't exist:
    I still have no idea why it would say the issue was frame 147:10

  • Using papervision in flash builder and getting TypeError: Error #1009: when using object.pitch(5)

    When i use papervision in flash builder and i am doing a test, when i render a sphere using papervision with the following code it renders me the sphere.
    When i add a line sphere.pitch(2);      ||
    sphere.yaw(2);
    sphere.roll(2);
    i get the following error,
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at PvTest/onRenderTick()[D:\Android 3D\PvTest\src\PvTest.as:39]
    Can anyone help me figure out the error
    For additional Info, these are the imports i am doing:
    import org.papervision3d.objects.primitives.Sphere;
    import org.papervision3d.view.BasicView;

    I followed the steps and read some of your comments on the same top topic in another thread. When I put it on the first frame it was okay but the next button on that page had the same problem.  So what I am guessing is that I have to either create a document class or put the actions where the buttons are.  Am I understanding that correctly?  In the other thread in which you helped someone else; there was so comments about document class.  I found a tutorial on it and the way I understand it is that it you can put you actions in an external document.  But you have to include in the event listener the frame in which you want that action to happen.
    Thaks for your help.  And patience.

  • AIR 3.7 Beta: TypeError: Error #2022 occurs for an unrelated class

    On AIR SDK 3.7.0.1240, the error "TypeError: Error #2022: Class (flash.text.Font-derived class) must inherit from DisplayObject to link to a symbol" occurs when instantiating an unrelated class when launched in the Flash Builder debugger.
    Include an swc with a linkage built with Flash Pro and instantiate a class (ClassA) in the swc results in:
    TypeError: Error #2022: ClassB must inherit from DisplayObject to link to a symbol.
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at ClassA()
    Does anyone see this? Because of this problem, I can't evaluate AIR 3.7 Beta at all.
    I entered the bug here.
    https://bugbase.adobe.com/index.cfm?event=bug&id=3520793

    no, i try to install air app on desktop that was build month ago, and was succefully installed previously
    but now, said that there is a problem, and i need to send request to this app developer (me)
    problem was with certification, it was expired, generate new one, compile app, and it installed
    sry for bad english

  • Component on Scene 2 causes TypeError: Error #1009??

    This one should be easy to explain because I'm sure a lot of
    you have noticed it. Just create a Scene 2 and put any component
    (EDIT: Try FLVPlayback since removing and re-adding the other
    components seemed to work for me) on the stage and compile. You'll
    get this error:
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    at
    Untitled_fla::MainTimeline/__setProp___id1__Scene2_Layer1_0()
    at Untitled_fla::MainTimeline/frame1()
    where id1 is the instance name if you assigned one.
    My original project worked fine in CS3 (actionscript 3, Flash
    9 project) but after upgrading to CS4 I got this error when
    compiling. I thought it had to do with not having a
    addEventListener(Event.ADDED_TO_STAGE, onAddedToStage); but once I
    narrowed it down to the issue with Scenes and Components I figured
    it must not.
    What is causing this and how do I fix it?
    Thank you!

    I'm on a plain 10.0 but I don't think it is a Flash issue as
    you are trying to do something that is not possible. I jumped
    directly from 8 to CS4 so I cannot tell about how CS3 handles
    things, but you will not be able to access a component from within
    a scene that does not contain the instance.
    Or will you also get the error on a plain Scene 1 and Scene 2
    containing only a simple button component? As said, I don't.

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

    Hi, I’m doing a game for an assignment for college. Using Flash CS 5. I got this error
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at code::Game1()
    When I tried to go to the next page, I thought I linked correctly. Can anyone help me? Thanks
    you can find the coding here http://pastebin.com/iz8a6w6Z

    click file>publish settings>swf and tick "permit debugging".  retest.
    the problematic line number will be in the error message.  that will tell you which reference you're trying to use that is null.

  • TypeError: Error #1009: from Label.as:1266

    I'm building an application that has 3-4 level deep navigation and I'm using a 'stack' of view states to navigate to user requested screen.
    I recently changed the navigation by bringing a screen that was 4-level deep to higher-level and now when I try to navigate to this screen, I get this error:
        TypeError: Error #1009: Cannot access a property or method of a null object reference.
         at spark.components::Label/truncateText()[E:\dev\4.x\frameworks\projects\spark\src\spark\com ponents\Label.as:1266]
         at spark.components::Label/http://www.adobe.com/2006/flex/mx/internal::composeTextLines()[E:\dev\4.x\frameworks\proje cts\spark\src\spark\components\Label.as:485]
         at spark.components.supportClasses::TextBase/updateDisplayList()[E:\dev\4.x\frameworks\proje cts\spark\src\spark\components\supportClasses\TextBase.as:684]
         at mx.core::UIComponent/validateDisplayList()[E:\dev\4.x\frameworks\projects\framework\src\m x\core\UIComponent.as:8709]
         at mx.managers::LayoutManager/validateClient()[E:\dev\4.x\frameworks\projects\framework\src\ mx\managers\LayoutManager.as:932]
         at mx.core::UIComponent/validateNow()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\U IComponent.as:7792]
         at spark.components::DataGroup/initializeTypicalItem()[E:\dev\4.x\frameworks\projects\spark\ src\spark\components\DataGroup.as:291]
         at spark.components::DataGroup/ensureTypicalLayoutElement()[E:\dev\4.x\frameworks\projects\s park\src\spark\components\DataGroup.as:346]
         at spark.components::DataGroup/startVirtualLayout()[E:\dev\4.x\frameworks\projects\spark\src \spark\components\DataGroup.as:1183]
         at spark.components::DataGroup/updateDisplayList()[E:\dev\4.x\frameworks\projects\spark\src\ spark\components\DataGroup.as:1313]
         at mx.core::UIComponent/validateDisplayList()[E:\dev\4.x\frameworks\projects\framework\src\m x\core\UIComponent.as:8709]
         at mx.managers::LayoutManager/validateDisplayList()[E:\dev\4.x\frameworks\projects\framework \src\mx\managers\LayoutManager.as:663]
         at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.x\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:736]
         at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.x\frameworks\projects \framework\src\mx\managers\LayoutManager.as:1072]
    Sadly, the error doesn't point to any part of my code and so I'm at a loss. I've spent quite a bit of time looking at different part of my code but haven't been able to solve this issue.
    Any suggestions on what I should look for or direction I should take to identify issue in my code?
    Thanks a lot!
    Dilip

    It's hard to know what exactly is going on without some code to look over.  What exact version (including build number) of the Flex SDK are you using?  You can find this is the root directory of the Flex SDK, in the flex-sdk-description.xml file.
    For Example
    <name>Flex Hero</name>
    <version>4.5.0</version>
    <build>17855</build>
    A null reference error happens when you try to access a property on a reference that is null.
    For example
    var foo:Object;
    trace(foo.bar);
    In this case foo hasn't been initialized, and is therefore null.
    Cheers,
    Nate Beck

  • TypeError: Error #1034 - Want to display a swf

    Hi,
    I´m new to AS3 and try to load/display swf´s on the stage. The swf´s should run and if the user clicks a button the next swf should be displayed.
    That works so far if I use some swf´s that are created also with FlashPlayer 9 and AS3. But if I use a swf created by someone else I get a TypeError: Error #1034. So far, I have no idea why this happens. Maybe you can have a look at my code and give me a hint. Thanks in advance.
    var configfile = "test.xml";
    var xml_url:String = configfile;
    var urlLoader:URLLoader = new URLLoader();
    urlLoader.addEventListener(Event.COMPLETE, setClips);
    var xml:XML;
    var currentClip:int = 0;
    var clips:Array = new Array(); btnPrevious.addEventListener(MouseEvent.CLICK, previousClip);
    setChildIndex(btnPrevious,1);
    btnNext.addEventListener(MouseEvent.CLICK, nextClip);    
    setChildIndex(btnNext,1);
    function setClips(e:Event) {
        this.xml = new XML(e.target.data);
        this.playClip(this.currentClip);
    function playClip(index:Number) {              
        if (!this.clips[index]) {           
            var request:URLRequest = new URLRequest(this.xml.item[index]);           
            var loader:Loader = new Loader();
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.setMovieClip);    
            loader.load(request);
        else {
            this.currentClip = index;              
         this.clips[this.currentClip].play();    
            this.addChild(this.clips[this.currentClip]);
            setChildIndex(this.clips[this.currentClip],0);              
            this.clips[this.currentClip].addEventListener(Event.ENTER_FRAME, this.onEnterFrameCheck);
    function nextClip(e:MouseEvent) {
         this.clips[this.currentClip].gotoAndStop(0);
            this.removeChild(this.clips[this.currentClip]);
         this.currentClip = this.currentClip + 1;    
         if(this.currentClip == this.xml.item.length()) {
              this.currentClip = 0;
         this.playClip(this.currentClip);    
    function previousClip(e:MouseEvent) {
        this.clips[this.currentClip].gotoAndStop(0);
        this.removeChild(this.clips[this.currentClip]);
        this.currentClip = this.currentClip - 1;
        if(this.currentClip == -1) {
           this.currentClip = this.xml.item.length() - 1;    }         this.playClip(this.currentClip);    
    function setMovieClip(e:Event):void {    this.clips[this.currentClip] = MovieClip(e.target.loader.content);
        this.addChild(this.clips[this.currentClip]);
        setChildIndex(this.clips[this.currentClip],0);  
        this.clips[this.currentClip].addEventListener(Event.ENTER_FRAME, this.onEnterFrameCheck);
    function onEnterFrameCheck(e:Event):void {
        if(this.clips[this.currentClip] && this.clips[this.currentClip].currentFrame == this.clips[this.currentClip].totalFrames) {
            this.clips[this.currentClip].gotoAndStop(0);    
            this.clips[this.currentClip].removeEventListener(Event.ENTER_FRAME, this.onEnterFrameCheck);         
            this.removeChild(this.clips[this.currentClip]);    
            if(this.currentClip >= this.xml.item.length()-1) {
                 this.currentClip = -1;
         }                               this.currentClip++;              
            this.playClip(this.currentClip);
    urlLoader.load(new URLRequest(this.xml_url)); 
    stop();
    And here The XML:
    <banners>
    <item>banner1.swf</item>
    <item>banner2.swf</item>
    <item>banner3.swf</item>
    </banners>
    The full Error Message (In German:)
    TypeError: Error #1034: Typumwandlung fehlgeschlagen: flash.display::AVM1Movie@34d4df9 kann nicht in flash.display.MovieClip umgewandelt werden.
        at teaser_fla::MainTimeline/setMovieClip()

    The problem will be related to trying to manipulate an AS1/AS2 file using AS3... it cannot be done.  In this case, you are probably just seeing the first of a few errors where you try to manipulate an AS2 object by trying to cast it as an AS3 MovieClip object.  You would run into problems later when you try controlling/reading that same file (currentFrame is not an AS1/AS2 property, but you attempt to extract it).
    Per the Flash Help documentation...
    "ActionScript 3.0 code can load a SWF file written in ActionScript 1.0 or 2.0, but it cannot access the SWF file's variables and functions. "
    You can implement the LocalConnection class to overcome some of the issues, but if you are using other people's files, you are likely to hit a wall...
    "LocalConnection objects created in ActionScript 3.0 can communicate with LocalConnection objects created in ActionScript 1.0 or 2.0.
    The reverse is also true: LocalConnection objects created in ActionScript 1.0 or 2.0 can communicate with LocalConnection objects created in ActionScript 3.0. Flash Player handles this communication between LocalConnection objects of different versions automatically."

  • TypeError: Error #1006 - Removing MovieClip from the stage

    I have a movie clip that is called to the stage and once the movieclip is finished it calls a function that removes it from the stage. The code works but I get an error message about 4 seconds after the movie clip ends.
    Here’s the error message:
    TypeError: Error #1006: exitWordMicroscopic is not a function.
                    at ASvocabulary_microscopic/frame110()[ASvocabulary_microscopic::frame110:1]
    Here’s the stage code:
    //************************Removes the movieclip from the stage and enables the button.*************************
    function exitWordMicroscopic():void
                    bnt_vocab_microscopic.mouseEnabled = true;
                    removeChild(word_Microscopic);
    //******************************Stage buttons**************************************
    stage.addEventListener(MouseEvent.MOUSE_DOWN, goButtonsHomeRead_1);
    function goButtonsHomeRead_1(event:MouseEvent):void
                    //Vocabulary buttons
                    if (event.target == bnt_vocab_microscopic)
                                    bnt_vocab_microscopic.mouseEnabled = false;
                                    SoundMixer.stopAll();
                                    addChild(word_Microscopic);
                                    word_Microscopic.x = 47;
                                    word_Microscopic.y = 120;
    Here’s the code inside the movie clip. This is what the error message is referring to:
    //****************** Calls function to remove itself from the stage****************************
    Object(parent).exitWordMicroscopic();
    What am I doing wrong?

    Here' how the code looks now:
    Objective: To remove the current movieclip while it's playing so that it does not show on the next (or previous) frame.
    Here’s the stage code:
    var word_Microscopic:ASvocabulary_microscopic = new ASvocabulary_microscopic();
    //Removes the movieclip from the stage and enables the button.
    function exitWordMicroscopic():void
        bnt_vocab_microscopic.mouseEnabled = true;
        removeChild(word_Microscopic);
    //******************************Stage buttons**************************************
    stage.addEventListener(MouseEvent.MOUSE_DOWN, goButtonsHomeRead_1);
    function goButtonsHomeRead_1(event:MouseEvent):void
        //Vocabulary buttons
        if (event.target == bnt_vocab_microscopic)
            SoundMixer.stopAll();
            bnt_vocab_microscopic.mouseEnabled = false;
            addChild(word_Microscopic);
            word_Microscopic.x = 47;
            word_Microscopic.y = 120;
            word_Microscopic.play();
    //This button takes the user to the Main Screen
        if (event.target == bnt_ReadGoHome_1)
           // exitWordMicroscopic(); [If I use this function I get this error ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.]
            SoundMixer.stopAll();
            gotoAndPlay("1","Main");
            stage.removeEventListener(MouseEvent.MOUSE_DOWN, goButtonsHomeRead_1);
    //This takes the user to the next frame.
    if (event.target == GoNext_1)
            SoundMixer.stopAll();
            gotoAndPlay("2");
            stage.removeEventListener(MouseEvent.MOUSE_DOWN, goButtonsHomeRead_1);
    Here’s the code inside the movie clip.
    //****************** Calls function to remove itself from the stage****************************
    Object(parent).exitWordMicroscopic();

Maybe you are looking for

  • Bold 9650 is the WORST phone I have ever had!!! :-(

    OK... I "upgraded" my phone to the Bold 9650 when it just came out earlier this year, wanting the latest and greatest. I have been an extremely loyal BlackBerry user for more than a decade. In fact, one BlackBerry I had a while back went a year-and-a

  • Ios 8.2 Battery Draining

         Hi All, i have an iPhone 5s 16GB running ios 8.2 and i am facing a huge battery draining , even i did the following : reduce motion closed turned on increase contrast turn off fetch mail turn off blue tooth using only 2G or 3G no 4G/LTE decrease

  • AD-HOC Documentation

    Hi,      I need some documentation material which provides to work on Ad-Hoc Queries in WAD. I am very new to BW as well I have little bit idea about WAD.      Please email to [email protected] Regds Sam

  • How to merge indexes in TREX?

    We use TREX for our EP7.0 KM project. I see there is a "merge indexes" but I am not sure how to use it. Could you share your experience on this? Thanks a lot!

  • Divisor by zero error...pls suggest

    Howdy folks, First message in this forum and newbie to oracle I am getting divisor by zero error for the following simple query. can some one suggest other ways of doing this math query instead? SELECT COUNT(*),ROUND(sum(A.MONTH_TO_MATURITY*A.PRIN_BA