Error #1009 - buttons on new executives

Hello

* I'm a little new to ActionScript 3 you must forgive my probably inaccurate descriptions, but here we deplacements.*

I am developing a flash website and (surprise, surprise) I am using the buttons... but I get errors. I get error #1009 and think that I found the problem I am facing:

The first group of 3 buttons (let's call group them A1 for clarity) is the Framework 1. Each of these buttons leads to its own subpage of 2 buttons (groups A2 - C2) that each leads to its own page (and, therefore, framework.)

Here is a graph that illustrates my layout of the site, it also illustrates my love for graphics.

graph.png

I use your common code for the buttons, but I get the error #1009. I think it's because the buttons I've included in the code are in different time periods, despite the code being written in the same place.

What should I do to fix this?

Thank you

Joshua

You cannot reference a button using actionscript until it exists, or you will get this error 1009.

for example, if the code for all of these buttons is on frame 1 of your main timeline, you add all these buttons to the stage in frame 1.

because you want all these buttons visible on frame 1 to the start of your swf file you can use the visible property to control what the user sees (and does not).

Tags: Adobe Animate

Similar Questions

  • TypeError: Error #1009: when communicating to a button in a MovieClip

    I get the following error:

    [SWF] ProjectZ_iOS.swf - 12154544 bytes after decompression

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

    at ProjectZ_iOS_fla::MainTimeline/goButtons() [ProjectZ_iOS_fla. MainTimel ine::frame71:54]

    By trial and error, I have reduced this problem down (line 54) of an 'if' statement (and all the other instructions) that communicate to a button in a movie clip (PopUp_GetMore.bnt_MoreRemixesGoHome). When the user clicks this button I want to delete the movieclip on the stage and turn the visibility of the other buttons to true. I get this error for every query that communicates to a button in the movieclip. I have several conditions in the service, but for example I am love, only include the declaration for a button below:

    Variables

    var PopUp_GetMore:MainMoreRemixes_mc = new MainMoreRemixes_mc();

    //******************************Stage buttons**************************************

    stage.addEventListener (MouseEvent.MOUSE_DOWN, goButtons);

    function goButtons(event:MouseEvent):void

    {

    Add the movieclip on the stage

    if(Event.Target == bnt_GetMore)

    {

    addChild (PopUp_GetMore);

    PopUp_GetMore.x = stage.stageWidth/2;

    PopUp_GetMore.y = stage.stageHeight/2;

    bnt_Behind.visible = false;

    bnt_GetMore.visible = false;

    bnt_Facts.visible = false;

    bnt_AuthorIllustrator.visible = false;

    }

    Deletes the clip of the scene

    If (event.target is PopUp_GetMore.bnt_MoreRemixesGoHome)

    {

    removeChild (PopUp_GetMore);

    bnt_Behind.Visible = true;

    bnt_GetMore.Visible = true;

    bnt_Facts.Visible = true;

    bnt_AuthorIllustrator.Visible = true;

    }

    }

    What I am doing wrong? If the declarations as communcate with the buttons inside the movieclip appear in another function?

    1009 error indicates that one of the objects targeted by your code are out of reach.  This may mean that the object...

    -is declared but not instantiated

    n ' is not have an instance name (or the name of the instance is misspelled)

    n ' is not in the frame where this code tries to talk to her

    -is animated in place, but is not assigned the name of the instances of each keyframe for her

    -is one of the two or more consecutive keyframes of the same objects without a name assigned in the image previous (s).

    If you go to your section to publish the Flash settings and select permit debugging option, your error message should have a suite of line number the number of the frame that will help you to isolate the object that is involved.

    And just in case it might be a misspelling... If it is a button would not name more likely include "btn" rather than "bnt".

  • Flash help-trying to make movement buttons images (getting error 1009)

    Help! I am trying to create a portfolio site, and I want my photo strip to flow and then become buttons. I did the buttons, but once the tape stops I get this message.

    TypeError: Error #1009: cannot access a property or method of a null object reference.
    at portfolio_fla::MainTimeline/frame62()
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()

    This is the code I have in the Panel actions

    Stop();

    LISTEN TO THE CLICK OF THE BUTTONS

    pics_mc.card_btn.addEventListener (MouseEvent.CLICK, cardClick);

    function cardClick(e:MouseEvent):void {}
    trace ("cardClick");

    }

    pics_mc.wine_btn.addEventListener (MouseEvent.CLICK, wineClick);

    function wineClick(e:MouseEvent):void {}
    trace ("wineClick");
    }

    pics_mc.edge_btn.addEventListener (MouseEvent.CLICK, edgeClick);

    function edgeClick(e:MouseEvent):void {}
    trace ("edgeClick");

    }

    pics_mc.group_btn.addEventListener (MouseEvent.CLICK, groupeCliquez here);

    function groupClick(e:MouseEvent):void {}
    trace ("groupClick");

    }

    pics_mc.romeo_btn.addEventListener (MouseEvent.CLICK, romeoClick);

    function romeoClick(e:MouseEvent):void {}
    trace ("romeoClick");

    }

    I am new to flash
    Thank you!

    1009 error indicates that one of the objects targeted by your code are out of reach.  This may mean that the object...
     
    n ' is not in the display list
    n ' is not have an instance name (or the name of the instance is misspelled)
    n ' is not in the frame where this code tries to talk to her
    -is animated in place, but is not assigned the name of the instances of each keyframe for her
    -is one of the two or more consecutive keyframes of the same objects without a name assigned in the image previous (s).
     
    If you go to your section to publish the Flash settings and select permit debugging option, your error message should have a suite of line number the number of the frame that will help you to isolate the object that is involved.

    Since you say that you move things in, I suspect the 4th listed element could relate to your problem, but it could be one of them.

  • New action script and get: TypeError: Error #1009: cannot access a property or method of a nude

    I get this message in the tab out to the buttons that I am creating.  Here is the code:

    import flash.events.MouseEvent;

    Stop();

    function goHome(myEvent:MouseEvent):void {}
    gotoAndStop ("home");
    SoundMixer.stopAll ();
    }
    function goAbout(myEvent:MouseEvent):void {}
    gotoAndStop ("about");
    SoundMixer.stopAll ();
    }
    function goBusiness(myEvent:MouseEvent):void {}
    gotoAndStop ("business");
    SoundMixer.stopAll ();
    }
    function goContact(myEvent:MouseEvent):void {}
    gotoAndStop ("contact");
    SoundMixer.stopAll ();
    }
    function goArchives(myEvent:MouseEvent):void {}
    gotoAndStop ("archives");
    SoundMixer.stopAll ();
    }
    function goBioTech(myEvent:MouseEvent):void {}
    gotoAndStop ("bioTech");
    SoundMixer.stopAll ();

    }
    function goRealEstate(myEvent:MouseEvent):void {}
    gotoAndStop ("realEstate");
    SoundMixer.stopAll ();
    }
    function goTechnology(myEvent:MouseEvent):void {}
    gotoAndStop ("technology");
    SoundMixer.stopAll ();
    }
    function goEnergy(myEvent:MouseEvent):void {}
    gotoAndStop ("energy");
    SoundMixer.stopAll ();
    }

    home_btn.addEventListener (MouseEvent.CLICK, goHome);
    about_btn.addEventListener (MouseEvent.CLICK, goAbout);
    business_btn.addEventListener (MouseEvent.CLICK, goBusiness);
    contact_btn.addEventListener (MouseEvent.CLICK, goContact);
    archives_btn.addEventListener (MouseEvent.CLICK, goArchives);
    bioTech_btn.addEventListener (MouseEvent.CLICK, goBioTech);
    realEstate_btn.addEventListener (MouseEvent.CLICK, goRealEstate);
    technology_btn.addEventListener (MouseEvent.CLICK, goTechnology);
    energy_btn.addEventListener (MouseEvent.CLICK, goEnergy);

    I ran the debugger and got this:

    TypeError: Error #1009: cannot access a property or method of a null object reference.
    at peakInsights_fla::MainTimeline/frame1() [peakInsights_fla. MainTimeline::frame1:48]

    I guess it tells me that there is a problem with the line 48, but what?

    Home, about, company, contact, archives button works. On the business page, there's the biotech buttons left, technology, real estate and energy. When I test it. I get the finger, but the buttons do not work. This is my first flash site I'am so new, new.

    for each button (for example btn1), the image you want is more appear, add a keyframe to this image and attach code like:

    removeChild (btn1);  then return to the frame where you want it to appear use addChild (btn1);

    or

    Btn1. Visible = false;  then back to the frame where you want it to appear use btn1.visible = true;

  • Adobe Air + Box2D.swc = TypeError: Error #1009 / / new way of managing .swc files in Flash for iOS Apps?

    Hello

    I need your help please - I need to update one of my iOS Apps. In this application, I use Box2d for a simple maze game (this is an application for children). When I publish and test this game on my Mac it works fine. I can drag my hero (fish) in this maze and all detections of collision, gravity etc perfect work.

    maze.jpg

    When I test it on my iPad it does not work. The device debugger shows this error message:

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

    Global $init)

    Global $init)

    at Box2DAS.Common::b2Base$/initialize() [/ users/jan/Documents/_Projekte/Spielplatz/Universal_ Retina/src/com/Box2DAS/Common/b2Base.as:31]

    to wck::WCK/create() [/ utilisateurs/jan/Documents/_Projekte/Spielplatz/Universal_Retina/src/com/wck/WCK.as:26]

    in misc::Entity/ensureCreated() [/ users/jan/Documents/_Projekte/Spielplatz/Universal_Retina/s rc/com/misc/Entity.as:50]

    in misc::Entity/handleAddedToStage() [/ users/jan/Documents/_Projekte/Spielplatz/Universal_Ret ina/src/com/misc/Entity.as:100]

    in misc::Entity/handleAddedToStage()

    Line 31: loader = new CLibInit();

    Bildschirmfoto 2014-10-23 um 21.06.03.png

    I guess that "CLibInit" must come from the .swc file.

    The thing is:

    I won't change anything in this maze game - it seems it has to do something with the new version of Flash or Adobe Air. File box2d.swc is included:

    Bildschirmfoto 2014-10-23 um 21.01.26.png

    It has always worked like that - and it works when test on my Mac - but it doesn't work anymore on my current system.

    So I started my Mac from an older system (10.9.5 on an external HD) and published the App in Flash and Adobe Air 13.0 CS6 - then all of a sudden, he is working on my iPad as before. I was able to draw a fish and make it arround.

    The same project / app released from my current OS X 10.10 + Flash CC 2014 + Adobe Air 15.0.0.302 does not work. I still have this error message - I can't drag the fish - nothing happens. And I have no idea why this happens and what I could do. I searched all day for a solution but found nothing.

    If nothing has changed by the way Flash and/or Air manages the .swc files? Is there another way to include: import cmodule. Box2d.* / CLibInit?

    -If someone has an idea - please let me know!

    Best regards

    Jan

    SOLVED!

    I uncheck 'Schnelleres Verpacken aktivieren (Beta)' and now it works again! Hooray!

    @ Adobe: Please take a look at this!

  • TypeError: Error #1009? New to the use of AS3, please help!

    Hi, I'm doing a site in flash, and so far everything went perfectly well so far.
    I've done a few buttons using MovieClips and then animate it with some actionscript 3. from what I can tell there is nothing wrong with the code itself, the problem is with the clips or symbols or something...? what I need help!


    Here is the code for one of the buttons (I use the same code for each button only change the name of the instance):

    function btn1Over(event:MouseEvent):void {}

    btn1.gotoAndPlay ("Over");

    }

    function btn1Down(event:MouseEvent):void {}

    btn1.gotoAndPlay ("Down");

    }

    function btn1Out(event:MouseEvent):void {}

    btn1.gotoAndPlay ("Out");

    }

    Btn1.addEventListener (MouseEvent.ROLL_OVER, btn1Over);

    Btn1.addEventListener (MouseEvent.ROLL_OUT, btn1Out);

    Btn1.addEventListener (MouseEvent.CLICK, btn1Down);

    And here is the error message:

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

    to openingscene_fla::MainTimeline/frame107()

    at flash.display::Sprite/constructChildren()

    at flash.display::Sprite()

    at flash.display::MovieClip()

    to openingscene_fla::home5_38()

    at flash.display::Sprite/constructChildren()

    at flash.display::Sprite()

    at flash.display::MovieClip()

    to openingscene_fla::cartoon2_33()

    at flash.display::Sprite/constructChildren()

    at flash.display::Sprite()

    at flash.display::MovieClip()

    to openingscene_fla::about1_28()

    at flash.display::Sprite/constructChildren()

    at flash.display::Sprite()

    at flash.display::MovieClip()

    to openingscene_fla::contact3_23()

    at flash.display::Sprite/constructChildren()

    at flash.display::Sprite()

    at flash.display::MovieClip()

    at openingscene_fla::donate4_18()

    donate4, about1, housecalls.5, contact3, cartoon2 is the buttons I use the YOU for. But what is the problem with him, I do not understand what meens sprite / cunstructChildren () for example?

    Please help me!

    If you show you get the error message, then it would be possible to help you find the problem.  If you do not, you already said enough you should be able to fix the problem yourself, but it is difficult to say if you understand what you are being told.

  • So simple but does not work! Error # 1009

    Doing my first (very simple) interactive chart and am confused as to what could go wrong.

    I have four buttons running from left to right. In the initial screen on the test I can navigate to the second, third and fourth positions on the timeline, but I can't go back. If I select the third button I can move on to the fourth place, but can't go back to 1 or 2. If I test and immediately click the fourth button I can't navigate anywhere.

    Any help would be greatly appreciated.

    *****************************************

    Error

    TypeError: Error #1009: cannot access a property or method of a null object reference.
    at RobberyTrends4_fla::MainTimeline/frame1() [RobberyTrends4_fla. MainTimeline::frame1:12]

    *********************************

    Stop();


    import flash.events.MouseEvent;


    Lossesbtn.addEventListener (MouseEvent.CLICK, showLosses)
    Injuriesbtn.addEventListener (MouseEvent.CLICK, showInjuries)
    Countermeasuresbtn.addEventListener (MouseEvent.CLICK, showCountermeasures)
    Incidentsbtn.addEventListener (MouseEvent.CLICK, showIncidents)


    function showLosses(event:MouseEvent):void
    {
    gotoAndStop ("Losses");

    }

    function showIncidents(event:MouseEvent):void
    {
    gotoAndStop ("incident");

    }

    function showInjuries(event:MouseEvent):void
    {
    gotoAndStop ("Injuries");

    }

    function showCountermeasures(event:MouseEvent):void
    {
    gotoAndStop ("Countermeasures");

    }

    Yes, this could be a way for you to solve this problem.  If your buttons exist permanently along the timeline without interruption of new instances of them, then they will all work when called.

    If you who continue and don't want the buttons to appear in their frames of destination, then you can set the visible property to false and keep the replacement images you already have in place... just to keep them on another layer.  You need to just reset their visible property when you move elsewhere.  The best way to do that is to create a reset function that you call in the destination of all executives just before the line where you set the invisible framework... button meaning first set visible property all the buttons for real, then select that you don't want showing on the right wrong after that.

    Another way, you might be able to get out is to have your functions defined in the first frame of a layer of actionscript that extends along the timeline and have it contain the functions of event handler for the button.  In this way, that the functions are available for the length of the timeline.  The part that needs special attention is you set the headphones of events for the buttons in the keyframes you have along the timeline.  So if interrupt you a button along the timeline with a stand-in image, then all instances of this button in the timeline panel need to have the event be given listener

  • Error with buttons

    I have a game with multiple images (Menu, Instructions and game). I have a button in the frame 1 (menu) for taking me to frame 2 and 3, one for frame 2 (game) works like a charm, that of frame 3 in contrast, sends me an error. Frame 2 is completed, the coding is done for her, all I have in the frame 3 is a button. I tested the animation with correct the thing, and the error also indicates the button itself. The button is custom made and imported into the library. However, if I use one of the buttons "preset" in flash, it works very well, it is not the end of the world if I used their buttons, but mine are prettier, someone has an idea?

    This is the error

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

    at NimGame_fla::MainTimeline/frame1()

    at flash.display::MovieClip/gotoAndStop()

    at NimGame_fla::MainTimeline/toMenu()

    I don't download and fix the files unless I'm hired.  free help, I offer via the adobe forums and this problem is solvable by the fourms.

    It would be quicker to pay me to solve the problem, but if you're patient, you should be able to solve this problem free of charge.

    remove the button from your problem all over your project.

    Create a new layer in the main storyline that extends up to the last frame of the main timeline.

    Slide the problematic of the library in the image of the new layer 1 of the main timeline, and then assign the problematic instance name!

    test.

  • Error #1009: What eventlistener is other than frame 1

    So what I'm trying to do, is to build a simple page where from the first page with buttons. You click a button and it triggers a simple STOP function like this:


    Stop();

    l2v2_btn.addEventListener (MouseEvent.CLICK, l2v2);

    function l2v2(event:MouseEvent):void

    {

    gotoAndStop (2);

    }

    From there I want each page to have a bunch of buttons, each button represents a sound that plays when you hit. Wonder, works, easy, swell.

    The problem is when I try to attach a function to these buttons. I want that each press of the button to add a child, or remove a child. Now... when I've just do everything on frame 1 - no problem, but when I leave the frame 1 (main menu for any other image (at this stage, part 2) I get this, a mistake that I am so sick of I may vomit.)

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

    to * _fla::MainTimeline/frame2()

    at flash.display::MovieClip/gotoAndStop()

    to * _fla::MainTimeline/l2v2()

    actions on frame 1 are above

    code on frame 2 ate here:


    var nd: and = new And();

    var big: big = new Big().

    class var = 'none ';

    and_btn.addEventListener (MouseEvent.CLICK, fAnd);

    big_btn.addEventListener (MouseEvent.CLICK, fBig);

    function fBig(event:MouseEvent):void

    {

    If (current == "none")

    {

    addChild (nd);

    current = nd.name;

    }

    ElseIf (current! = "none")

    {

    removeChild (getChildByName (current));

    addChild (nd);

    ND.x = 818;

    ND.y = 438;

    current = nd.name;

    }

    }

    function fAnd(event:MouseEvent):void

    {

    If (current == "none")

    {

    addChild (big);

    current = big.name;

    }

    ElseIf (current! = "none")

    {

    removeChild (getChildByName (current));

    addChild (big);

    current = big.name;

    }

    }

    Basically, I want just a home page, I click on one takes button me to another page with buttons, each button plays an audio vocabulary and adds a sprite (Word vocab onstage) when

    It works when I'm on frame one, the permutation on the sprites, but when I try to go to another frame with the same it getting the above error. I know it is a simple problem, could someone help please? It makes me crazy


    In fact, it seemed to solve my problem:

    this.addEventListener (Event.ENTER_FRAME, onEnterFrame, false);

    Call this auditor function continuously until all the buttons are taken into account

    function onEnterFrame(e:Event):void

    {

    If (and_btn! = null & big_btn! = null)

    {

    and_btn.addEventListener (MouseEvent.CLICK, fAnd);

    big_btn.addEventListener (MouseEvent.CLICK, fBig);

    clean the enter frame listener so that this function is no longer is called

    this.removeEventListener (Event.ENTER_FRAME, onEnterFrame, false);

    }

    }

    Of course now I don't know how to add sprites on the stage on an other than 0,0 starting position.

  • Need help with Error #1009

    Hello, I am working on a Flash game where you navigate in different rooms. Each room is located in a frame on the main timeline. I get an error message #1009 when I navigate to certain parts, but each image almost the same code, so I don't know why some executives encounter this problem while others are very well. When the error message that I am always directed to the 'room' I clicked on, but all the buttons in this room disappear and you are then stuck there and having to restart the project. I looked through other forums where people had this error message similar but I could not find a solution that could help me, so I apologize for the display of such a common problem! Here is a screenshot of the error message I get, which says:

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

    at project1_fla::MainTimeline/frame4() [project1_fla. MainTimeline::frame4:43]

    at flash.display::MovieClip/gotoAndStop()

    at project1_fla::MainTimeline/enterElevator3() [project1_fla. MainTimeline::frame12:25]

    errormessage.png

    Here are links to the screenshots of the debugging session where it points to the lines of code that contains the error and also screenshots of my code in these pictures:

    Frame error 4 part 1

    Frame error 4 part 2

    Frame error 12 part 1

    Frame error 12 part 2

    Code for chassis 4 part 1

    Code for chassis 4 part 2

    Code 4 room 3

    Code for chassis 4 part 4

    Code for frame 12 part 1

    Code for frame 12 part 2

    Frame 4 is labeled as 'elevator' and armature 12 is "medEntrance". I know that the problem is to jump from an image to the image, but I honestly have no idea what would be the error. I double checked all my code and it must be correct, and what makes it even more confusing, is that some rooms work perfectly while others have this problem and they all use the exact code, but with different names of MC! :/ Something I noticed is that the rooms which are most often linked to (for example that the lift can bind to three different "floors" or frames) are those who encounter this problem. But I chose this pair in particular because it contains the least amount of code I do not understand why have several frames, a link to a picture in particular would be a problem, but it's my first time using Flash and AS3 so I don't know any with its limits.

    Sorry for the overload of code and messy information! I thought it's better to provide too much information than too little and thanks for your help, it is much appreciated!

    rather than distributing your rooms in different key frames,

    Move them to separate the layers

    and use only the first image of each layer

    then do what amy suggested and is wirtie a document class that will have all your key code in

    or put all your code on the first frame of the first layer (separate layers where you have your rooms on)

    So, it becomes available for all your parts.

    To hide rooms you don't currently need put all the parts inside a table:

    var rooms: Array = [room1 room2... room100];

    then write a function

    function showRoom(_index:int):void {}

    for (var i: int = 0; i<>

    {if(i==_index)}

    rooms [i] .visible = true;

    }

    else {}

    rooms [i] .visible = false;

    }

    }

    }

    for example, when you move to the next room call sth. as

    showRoom (4);

    This will hide all parts in addition to the 5th

  • Logic function triggered by entering the framework returned error #1009

    I have five boxes to click on a screen (buttons with an area of key but no picture).  If a user clicks on a box for the first time, a graphic tick appears and a variable is set to True.  If the user clicks on the box again once the tick disappears and the variable is set to false.

    When the user clicks the next button the next slide will vary according to which the variables are set to True.

    That's all works fine, but if I go forward and then back to my frame, the ticks disappear.  I tried to create a new function to run as soon as I returned to the image, check if the variables are set to True or False and show appropriate ticks.  It works and there is no error when I run at the beginning of the film.  But when I click on the next button to leave the framework (framework 5) I get a lot of messages like this:

    TypeError: Error #1009: cannot access a property or method of a null object reference.
    [file name]: [(MainTimeline/ticksInBoxes)
    [filename]. MainTimeline::frame5:20]

    Here is the corresponding code on picture 5:

    addEventListener (Event.ENTER_FRAME, ticksInBoxes);

    btnNextS1Start.addEventListener (MouseEvent.CLICK, S1NavForward);

    functionticksInBoxes(event:Event):void

    {

    If (newtopic == false) {}

    box1Tick.visible = false;
    the row above this point is part 5, line 20, mentioned by the output message

    } else {}

    box1Tick.Visible = true;

    }

    If (NCO == false) {}

    box2Tick.visible = false;

    } else {}

    box2Tick.Visible = true;

    }

    If (change == false) {}

    box3Tick.visible = false;

    } else {}

    box3Tick.Visible = true;

    }

    If (recycling == false) {}

    box4Tick.visible = false;

    } else {}

    box4Tick.Visible = true;

    }

    If (badprac == false) {}

    box5Tick.visible = false;

    } else {}

    box5Tick.Visible = true;

    }

    }

    functionTopNew(event:MouseEvent):void

    {

    If (newtopic == false) {}

    newtopic = true;

    box1Tick.Visible = true;

    } else {}

    box1Tick.visible = false;

    }

    }

    functionTopNC(event:MouseEvent):void

    {

    If (NCO == false) {}

    eyeing = true;

    box2Tick.Visible = true;

    } else {}

    eyeing = false;

    box2Tick.visible = false;

    }

    }

    functionTopCha(event:MouseEvent):void

    {

    If (change == false) {}

    changes = true;

    box3Tick.Visible = true;

    } else {}

    changes = false;

    box3Tick.visible = false;

    }

    }

    functionTopRef(event:MouseEvent):void

    {

    If (recycling == false) {}

    recycling = true;

    box4Tick.Visible = true;

    } else {}

    recycling = false;

    box4Tick.visible = false;

    }

    }

    functionTopBad(event:MouseEvent):void

    {

    If (badprac == false) {}

    badprac = true;

    box5Tick.Visible = true;

    } else {}

    badprac = false;

    box5Tick.visible = false;

    }

    }

    function S1NavForward(event:MouseEvent):void

    {

    If (newtopic == true) {}

    gotoAndStop (6);

    } ElseIf (NCO == true) {}

    gotoAndStop (7);

    } Else if (change == true) {}

    gotoAndStop (8);

    } ElseIf (recycling == true) {}

    gotoAndStop (9);

    } Else if (badprac == true) {}

    gotoAndStop (10);

    } else {}

    trace ("nothing is selected");

    }

    }

    And here is the code on picture 6:

    btnNextNew.addEventListener (MouseEvent.CLICK, S1NavFromNew);

    btnPrevNew.addEventListener (MouseEvent.CLICK, S1NavBackFromNew);

    function S1NavFromNew(event:MouseEvent):void

    {

    If (NCO == true) {}

    gotoAndStop (7);

    } Else if (change == true) {}

    gotoAndStop (8);

    } ElseIf (recycling == true) {}

    gotoAndStop (9);

    } Else if (badprac == true) {}

    gotoAndStop (10);

    } else {}

    gotoAndStop (11);

    }

    }

    function S1NavBackFromNew(event:MouseEvent):void

    {

    gotoAndStop (5);

    }

    I worked there.

    I looked at http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/Event.html #ENTER_FRAME , who said that "this event has a"capture phase"nor a"bubble phase", which means that event listeners must be added directly to all targets potential, if the target is on the display list or not.

    So what I did is to change the event listener to say "box1Tick.addEventListener (Event.ENTER_FRAME, ticksInBoxes);".  Add this reference to one of the boxes used in the service was enough to get rid of the error message, even if the way in which the function ran did not this specific box visible.

    Huzzah!

  • Error #1009 in Flash

    Hello everyone, I'm having some unexpected problems in Flash. I wanted to build a basic Button, TextInput, and TextArera. The code looks fine. When I pressed ctrl + enter, I got a long enough message in the output panel. To be honest I don't understand what that means.

    Below, I typed the code and the message that I received in the exit sign its really too big to show that it is complete.

    Any suggestions to solve this problem would be appreciated.

    import flash.text.TextFormat;

    Import fl.controls.TextInput;

    Import fl.controls.TextArea;

    Import fl.controls.Button;

    import flash.events.MouseEvent;

    var tf:TextFormat = new TextFormat();

    TF.font = 'Arial ';

    TF. Size = 14;

    TF. Color = "0xff0000;

    var ti: TextInput = new TextInput();

    ti.setSize (429,00, 50.00);

    TI. Move (96.00, 286.00);

    TI.editable = true;

    TI.enabled = true;

    ti.setStyle ("textFormat", tf);

    addChild (ti);

    var your: TextArea = new TextArea();

    ta.setSize (96.00, 430.00);

    rah Move (246.00, 8 pm);

    TA.editable = false;

    TA.enabled = true;

    ta.setStyle ("textFormat", tf);

    addChild (ta);

    var mybutton:Button = new Button();

    mybutton.setSize (11: 00, 25);

    MyButton.Move (21, 287);

    MyButton.label = 'submit ';

    MyButton.Toggle = true;

    addChild (mybutton);

    mybutton.addEventListener (MouseEvent.CLICK, btnHandler);

    function btnHandler(event:MouseEvent):void {}

    trace ("Success");

    }

    Type error: Error #1009: cannot access a property or method of a null object reference

    to fl.controls::TextArea/drawLayout()

    to fl.controls::TextArea/draw()

    to fl.core::uicComponent/callLaterDispatcher()

    Type error: error 2007 # child parameter must be non-null

    at flash.display::Displayobjectcontainer/addChildat()

    to fl.controls::Basebutton/drawbackground()

    to fl.controls::BaseButton/draw()

    to fl.controls::uicComponent/drawNow()

    to fl.controls::scrollBar/draw()

    to fl.controls::uicscrollBar/draw()

    first of all, fix:

    TF. Color = "0xff0000;

    that should be:

    TF. Color = "0xff0000";

    or

    TF. Color = 0xff0000;

    Then, make sure you have a textarea in your library component.  (that is to say, drag the components Panel to the stage, then remove it).

    If that does not solve the problem click the file > publishing settings > swf and check the box "enable debugging".  Repeat the test.

    the number of problematic line will be in the error message.  that indicates the object that does not exist when your code runs.

    If you do not understand how to solve the problem and the above, the number of problematic line in your code.

  • Error #1009 when sound inside game, a movie clip that is called to the scene with child add method

    What is supposed to happen

    I have a clip that is called when the user clicks a button. When moving clip appears music is expected to play. When the user clicks the close button the music stops and the clip is removed from the scene.

    But then I get an error

    When I test the movie I get the following error:

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

    to mc_playSong / frame2 () [mc_playSong::frame2:6]

    This is the code that calls the clip on the stage (no problem here):

    Call the video clip with the song played on stage

    stage.addEventListener (MouseEvent.MOUSE_DOWN, goButtons);

    function goButtons(event:MouseEvent):void

    {

    If (event.target is song_bnt)

    {

    SoundMixer.stopAll ();

    addChild (myPlaySong);

    myPlaySong.x = 558;

    myPlaySong.y = 384;

    Event.stopImmediatePropagation;

    }

    The following code inside the clip is called to the scene. The music is meant to play:

    Stop();

    Variables for listening to music

    var RJPlaySong:RJSong = new RJSong();

    var RJPlaySongChannel:SoundChannel;

    Music for plays

    stage.addEventListener (Event.ENTER_FRAME, startRJSong); (I think that the error in the code is in this function. When I comment on him I don't get error.)

    function startRJSong(event:Event):void

    {

    RJPlaySongChannel = RJPlaySong.play ();

    }

    Stop all sounds, sets variables to null and calls a send event that removes the clip of the scene.

    bnt_closeSong.addEventListener (MouseEvent.MOUSE_DOWN, closeCreditSongScreen);

    function closeCreditSongScreen(event:MouseEvent):void

    {

    SoundMixer.stopAll ();

    RJPlaySong = null;

    RJPlaySongChannel = null;

    dispatchEvent (new Event ("RemoveMCsong"));

    }

    Someone at - it ideas? This seems to be a pretty simple question, but I can't understand it.

    I meant that you have quoted just to be taken literally.  If it's still not clear what I say or what did your code, try the following in order to demonstrate the IT change... This code to be...

    stage.addEventListener (Event.ENTER_FRAME, startRJSong);

    function startRJSong(event:Event):void {}

    trace ("I can do this all day");

    }

    After doing this, you can see why you want to only call the function once, and you could eliminate most of it and just put...

    RJPlaySongChannel = RJPlaySong.play ();

    Instead, or as I said originally, you can change it to be...

    function startRJSong (): void

    {

    RJPlaySongChannel = RJPlaySong.play ();

    }

    startRJSong();

  • TypeError: Error #1009 in different chassis

    Hello. I know there are a lot of discussions on this subject, but so far I have not found the answer I was looking for.

    I'm script in an Actionscript 3.0 file, not in the timeline itself.

    I am creating a point and adventure where the player move through different scene by clicking on the environment as a normal point and then click adventure game. I currently have only 2 images.

    I put the different scenes on different chassis where the Reader click the environment to move to this frame. However, when I put Morgoth movieclips and buttons in addEventListener on frame 2, I get:

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

    at Puzzle1copy()

    I ran debug and got this:

    Try to launch and connect to player using the URL D:\Users\kikilalaz\Desktop\New Sem\GameProjectStuff\Puzzle1Copy\Puzzle1copy.swf

    [SWF] D:\Users\kikilalaz\Desktop\New Sem\GameProjectStuff\Puzzle1Copy\Puzzle1copy.swf - 1183598 bytes after decompression

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

    at Puzzle1copy() [D:\Users\kikilalaz\Desktop\New Sem\GameProjectStuff\Puzzle1Copy\Puzzle1copy.as:18]

    I have read a lot of people, said the instance must be initiated first, until the eventlisteners can run, otherwise she will become zero.

    Currently, I do not know how to fix this and is about to go crazy to try many different methods from different sources.

    This is my code:

    Header 1

    package {}

    import flash.display. *;

    import flash.events. *;

    SerializableAttribute public class Puzzle1copy extends MovieClip

    {

    public void Puzzle1copy() {}

    Frame1 listeners

    btnTrashCan.addEventListener (MouseEvent.CLICK, TrashCom);

    btnRadiator.addEventListener (MouseEvent.CLICK, RadCom);

    btnRatHole.addEventListener (MouseEvent.CLICK, RatCom);

    mcVicMar.addEventListener (MouseEvent.CLICK, VicCom);

    mcWindow.addEventListener (MouseEvent.CLICK, WinCom);

    listeners frame2

    mcDirt.addEventListener (MouseEvent.CLICK, DirtCom);

    btnBack.addEventListener (MouseEvent.CLICK, GoBack1);

    }

    frame1 functions

    function TrashCom(e:MouseEvent) {}

    txtCom1.text = "This is a trashcan.";

    }

    function RadCom(e:MouseEvent) {}

    txtCom1.text = 'This is an old radiator.';

    }

    function RatCom(e:MouseEvent) {}

    txtCom1.text = "a rat hole. I can see rats inside. « ;

    }

    function VicCom(e:MouseEvent) {}

    txtCom1.text = "This must be where his body was found.";

    }

    function WinCom(e:MouseEvent) {}

    txtCom1.text = 'He is too dirty to see anything.';

    }

    functions of frame2

    function DirtCom(e:MouseEvent) {}

    txtCom2.text = "nothing but garbage here.";

    }

    function GoBack1(e:MouseEvent) {}

    gotoAndStop ("BackAlley");

    }

    }

    }

    Thank you very much for the help!

    This is because the button is facing the second image and you cannot apply event for this button the first button.

    You must wait until frame2 is rendered and for this button instance is put into service.

    This code will be like

    package {}

    import flash.display. *;

    import flash.events. *;

    SerializableAttribute public class Puzzle1copy extends MovieClip

    {

    var isSecond:Boolean = false; / / to ensure that this event is apply only once

    public void Puzzle1copy() {}

    Frame1 listeners

    btnTrashCan.addEventListener (MouseEvent.CLICK, TrashCom);

    btnRadiator.addEventListener (MouseEvent.CLICK, RadCom);

    btnRatHole.addEventListener (MouseEvent.CLICK, RatCom);

    mcVicMar.addEventListener (MouseEvent.CLICK, VicCom);

    mcWindow.addEventListener (MouseEvent.CLICK, WinCom);

    this.addEventListener (Event.ENTER_FRAME, onAddToStage) ;// add frame event enter.

    }

    function onAddToStage(e:Event):void

    {

    If (this.currentFrame == 1)

    {

    }

    Else if (this.currentFrame == 2) / / when reach the second image

    {

    If (! isSecond)

    {

    isSecond = true;

    mcDirt.addEventListener (MouseEvent.CLICK, DirtCom);

    btnBack.addEventListener (MouseEvent.CLICK, GoBack1);

    }

    }

    on the other

    {

    this.removeEventListener (Event.ENTER_FRAME, onAddToStage);

    }

    }

    frame1 functions

    function TrashCom(e:MouseEvent) {}

    txtCom1.text = "This is a trashcan.";

    }

    function RadCom(e:MouseEvent) {}

    txtCom1.text = 'This is an old radiator.';

    }

    function RatCom(e:MouseEvent) {}

    txtCom1.text = "a rat hole. I can see rats inside. « ;

    }

    function VicCom(e:MouseEvent) {}

    txtCom1.text = "This must be where his body was found.";

    }

    function WinCom(e:MouseEvent) {}

    txtCom1.text = 'He is too dirty to see anything.';

    }

    functions of frame2

    function DirtCom(e:MouseEvent) {}

    txtCom2.text = "nothing but garbage here.";

    }

    function GoBack1(e:MouseEvent) {}

    gotoAndStop ("BackAlley");

    }

    }

    }

    I hope this will help u.

  • Error #1009 Help!

    Dear all,

    I hope you can help me with what is probably something very simple but seems to touch most of the people! However, I spent all day researching it and try all sorts of codes to solve the error!

    I am trying to build a new website using Flash CS5 and I'm very new to any script business (as3).  After finishing the main content of the site, I created an external preloader, so it can load the main SWF file. However, when I debug or test the scene I get this error:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
       at Index_fla::MainTimeline/frame1()[Index_fla.MainTimeline::frame1:11]

    After many hours, I find the publication settings, publication of debugging that actually tells me what mount / the origin of the problem! If I go to my main file (called Index.Fla) and look at picture 1, line 11, it says:

    var buttonsArray:Array = [works_btn,about_btn,contact_btn];

    ... that sounds right, seem to consider when the preloader is finished the file flash main (work/comments/contact) navigation buttons does not quite right. They still work take back you to the right pages (or frames) but the mouse, mouse click, functions do not work.

    Now, I'm not really sure how to deal with this, because all the buttons (which are video clips) are located on the frame one and carry the name of the instance to the right and MORE when I debug the Index.Fla file, everything works normally.

    Should I assume that there is something wrong with my preloader file?

    Below is the script for the preloader and frame a fo the index file. I hope you can help me! Thank you!

    PRELOADER:

    var l:Loader = new Loader();

    l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
    l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
    l.load(new URLRequest("Index.swf"));

    function loop(e:ProgressEvent):void
    {
       var perc:Number = e.bytesLoaded / e.bytesTotal;
       percent.text = Math.ceil(perc*100).toString() + "% Complete";
    }

    function done(e:Event):void
    {
       removeChildAt(0);
       removeChild(preloader)
       percent = null;
       addChild(l);

       l.contentLoaderInfo.removeEventListener( ProgressEvent.PROGRESS, loop);
       l.contentLoaderInfo.removeEventListener(Event.COMPLETE, done);

    }

    INDEX (MAIN - FRAME ONE FILE)


    stop();

    works_btn.addEventListener(MouseEvent.CLICK, navigationClicked);
    about_btn.addEventListener(MouseEvent.CLICK, navigationClicked);
    contact_btn.addEventListener(MouseEvent.CLICK, navigationClicked);

    stage.frameRate = 30;
    var buttonsArray:Array = [works_btn,about_btn,contact_btn];

       function setButtons():void
       { for (var i:int=0; i<buttonsArray.length; i++)
          {   buttonsArray[i].id = i;  
             buttonsArray[i].buttonMode = true;  
             buttonsArray[i].mouseChildren = false;  
             buttonsArray[i].mouseEnabled = true;  
             buttonsArray[i].addEventListener(MouseEvent.ROLL_OVER,playOver);  
             buttonsArray[i].addEventListener(MouseEvent.ROLL_OUT,playOut);  
             buttonsArray[i].addEventListener(MouseEvent.CLICK,doClick);  
          }
    }

    function playOver(event:MouseEvent):void
       {   event.currentTarget.gotoAndPlay("over");
       }
    function playOut(event:MouseEvent):void
       {   event.currentTarget.gotoAndPlay("out");
       }

    function doClick(event:MouseEvent):void{
      
       var currentBtn:int = event.currentTarget.id;  

       setSelectedBtn(currentBtn);
    }

    function setSelectedBtn(id:int):void{  
       for (var i:int=0; i< buttonsArray.length; i++) {  
          if (id == i) {  
             buttonsArray[i].gotoAndStop("down");  
             buttonsArray[i].buttonMode = false;  
             buttonsArray[i].mouseEnabled = false; 
             buttonsArray[i].removeEventListener(MouseEvent.ROLL_OVER,playOver);  
             buttonsArray[i].removeEventListener(MouseEvent.ROLL_OUT,playOut); 
             buttonsArray[i].removeEventListener(MouseEvent.CLICK,doClick);
             } else {  
                if(buttonsArray[i].currentLabel =="down"){
                   buttonsArray[i].gotoAndPlay("out");  
                   }  
                   buttonsArray[i].buttonMode = true;  
                   buttonsArray[i].mouseEnabled = true;  
                   buttonsArray[i].addEventListener(MouseEvent.ROLL_OVER,playOver);  
                   buttonsArray[i].addEventListener(MouseEvent.ROLL_OUT,playOut);  
                   buttonsArray[i].addEventListener(MouseEvent.CLICK,doClick);
                   }  
             }
          }
    setButtons();

    function navigationClicked(Event:MouseEvent):void
    {
       var frmLabel:String = '';

        switch (Event.target)
       {
          case works_btn :
                frmLabel = "Portfolio_frm";
                break;
            case about_btn :
                frmLabel = "About_frm";
                break;
            case contact_btn :
                frmLabel = "Contact_frm";
                break;
       }
         
       if (currentFrame != frmGoto)
       {
         
          var frmPortfolio:Number = this.getFrame("Portfolio_frm");
               
          gotoAndPlay(frmGoto);
       }
    }


    function getFrame(frameName:String):Number
    {
        var frame:Number = 1;

           for (var i = 0; i < currentLabels.length; i++)
        {
            if (currentLabels[i].name == frameName)
            {
                frame = currentLabels[i].frame;
                break;
            }
        }

        return frame;
    }

    Ahh! I'm sorry. I did it again (error code of purpose), and I think that the problem was:

    stage.frameRate = 30;

    I took it out and the notification of the error #1009 is gone! Don't know how or why he's done right! It is perhaps unnecessary coding?

    Thanks for your help if Kglad. Very appreciated

Maybe you are looking for

  • The names of my contacts are obsolete

    My friends contact photos are exceeded, except when I go to the version of the ios, they are always the same. It seems also that whenever I type something in chatit would just keep loading. Is anyway to fix this?

  • HDMI help requested

    When I plug my Xoom into my TV using a DVI-HDMI adapter / all I get on the TV screen is an Android asking 720 p? does anyone have any suggestions that the TV is a panasonic 53 ". Thank you Eric

  • API supported by NI OPC Server

    Hi all; The following controllers are supported by an OPC Server OR: -Yokogawa CS3000 -600 Smar Waiting for your valuable response. Thank you

  • The cable with the NI 9237 Position sensor

    Hello I have a NI 9237 Half/Full-bridge analog input module. Recently, I acquired a position sensor led cable, which is essentially a potentiometer. You can find the schema from the link below or in the attachment. http://www.celesco.com/_datasheets/

  • 0x100000EA and other problems on Windows 7 (64 bit) on HP Pavilion dv6-1330 ep

    I got the blue screen a few times with this error report, tried to recovery through partition; that could not, end up having to start from the Cd to reinstall windows 7. The problem remains, even after installation of the drivers available on the HP