Hang the function call after Document Class' Event.ADDED

I tried to load an external SWF (which contains the code below in its document class) with the charger of class but I keep getting Error #1009: cannot access a property or method of a null object reference. So I tried to use the Event.ADDED event listener in the constructor of MyDocumentClass of the external SWF file to leave the document class to be part of the display list, before I have to call createRandomGraph. But when I place createRandomGraph() inside onStageReady, the compilation process is suspended. When I left the createRandomGraph() inside the constructor, it works perfectly as isolated but will produce error 1009 so loaded in the SWF loader. Any ideas?

public void MyDocumentClass)

{

this.addEventListener (Event.ADDED, onStageReady);

createRandomGraph ( )

}

private void onStageReady(oEvent:Event): void

{

this.removeEventListener (Event.ADDED, onStageReady);

}

private void createRandomGraph(): void

{

var cRandomGraph:RandomGraph = new RandomGraph();

cRandomGraph.x = 10;

cRandomGraph.y = stage.stageHeight - nH - 25;

cRandomGraph.setDimensions (nW, nH);

cRandomGraph.createGraphBackground ();

this.addChild (cRandomGraph);

}

use:

public void MyDocumentClass)

{

this.addEventListener (Event.ADDED_TO_STAGE, onStageReady);

}

private void onStageReady(oEvent:Event): void

{

this.removeEventListener (Event.ADDED, onStageReady);

createRandomGraph();

}

private void createRandomGraph(): void

{

var cRandomGraph:RandomGraph = new RandomGraph();

cRandomGraph.x = 10;

cRandomGraph.y = stage.stageHeight - nH - 25;

cRandomGraph.setDimensions (nW, nH);

cRandomGraph.createGraphBackground ();

this.addChild (cRandomGraph);

}

Tags: Adobe Animate

Similar Questions

  • Problem accessing the service within my Document class

    Hello

    I have a Document class that dynamically adds a MovieClip to my Florida the MovieClip in the library FLA and has "Export for ActionScript" installation for him and that's how I access the My Document class MovieClip.

    The problem is that when the MovieClip is finished (he has a scenario animation and a stop() method applied to the last frame of the animation), I want him to call a function that is placed in my Document class, but simply call the function (for example displayEnterButton()); an error of...

    1180: call to a method may be undefined displayEnterButton.

    Can anyone help here, I'm sure it's a simple problem to solve.

    Thank you very much!

    Kind regards
    M.

    Hello

    I managed a work around that.

    Basically, my Document class, after the code that adds the MovieClip to the display list, I then put in place since a timer that called a function every 100 milliseconds. This function would then check the current image of the loaded MovieClip. If the current framework of the MovieClip is equal to the last frame of the MovieClip I know animation had finished and calls the following function that I needed.

    I pasted the code below in case anyone was interested...

  • Black screen when the phone call after 5.1

    The screen loses response (black screen) on the call (after dialing) after 5.0 OTA. But it works well if I plug headphones. The screen can also recover the black screen after I have connect a listener.

    Do you have a case on your phone? It can interfere with the proximity sensor and turn the screen black... it is supposed to do after you hold the phone to your ear/head so that your face not to accidentally push buttons.

    If it does when you do not hold your phone to your face/head/ear then something else is triggering the sensor of prox - often a case which is near the prox sensor, or a protective screen that is not clear in this area can cause this.

  • Is there a way to discover the function calling ESTK?

    Dear forum,

    How do you find the calling feature?

    I remember this issue has been asked on the forum before and, if my memory is good, it's Peter Kahrel who did it. Anyway, it was a long time ago and I can't find the post.

    main();
    function main() {
        hello();
    }
    function hello() {
        // Is it possible to find out that the caller function is 'main'?
    }
    
    

    Before taking the post, I googled for it and find many suggestions, for example:

    alert("caller is " + arguments.callee.caller.toString());
    
    

    But nothing works for me.

    Kind regards
    Kasyan

    Here is a new version of the function:

    function callerName() {
        var arr = $.stack.split(/[\n]/),
        callerName = arr[arr.length - 3].replace(/\(.*\)/, "")
        return callerName;
    }
    

    I fixed the regular expression to remove the brackets and everything.

    The previous version returns the name of the function with arguments, as follows:

    Result: ProcessTables ([paragraph: [object paragraph]])

  • Retrieve the name of the function call

    I have 2 function in the CFC, even calling another function in the same CFC.

    IS anyway to get the name of the first function (the appellants) from the second?
    OR
    is there anyway inside a function to retrieve this name?

    Sounds right up your alley:

    http://www.bennadel.com/blog/406-determining-which-function-called-this-function-using-Col dFusion .htm

  • Strange question 3D - all the textures appear the same texture after document resizing

    Hello

    I just had my first experience of 3D in Photoshop, a lot of options for different labels on a cylinder of mapping - everything worked perfectly until I have re-size of the image.

    Now each change of label-out gets appears as one of the labels - Photoshop displays a label despite the fact that there are layers of mutiple only and layers.

    If i:

    • Go to the diffuse texture for each label and choose 'Edit texture.
    • A new window opens to show the good label/texture

    Has anyone else seen elsewhere?

    Any pointers in the right direction would be much appreciated.

    See you soon

    Ben

    I fixed it by going into each diffuse texture and choose 'Change the UV properties' and press OK - that seem to reset and make a new render each texture.

    Seems to be a bug, unless you can use the Image size on documents containing layers 3D, maybe?

  • Linux - breaks down during the phone call after receiving the notice of someone who comes online

    Hello! Having a problem with Skype 4.2.0.11 for Linux.

    This happened to me twice today: during a phone conversation (I had dialed a phone number), after that Skype gave me a notice saying a contact had been online, the cut received phone call and Skype crashed. Ideas for solutions?

    I use Ubuntu 12.04, 64-bit, and once again the version of Skype is 4.2.0.11, please let me know if there is more information I could give that would help. Thank you!

    Sorry for typo's fault, I can't edit any longer after a day or two. Here's the good:

    sudo apt - get install libasound2 - plugins:i386

    Thank you

    Marco

  • Pass the parameter to the functions called from a dll

    Hi all

    I am interfacing a motor controller for PMC - 100 through the Protocol of Performax using labwindows.

    I need to explicitly link the PerformaxCom.dll and call functions with him. I'm calling this function

    BOOL fnPerformaxComOpen (DWORD IN dwDeviceNum, OUT HANDLE * pHandle);

    Faithful:

    If you want to link explicitly, you can consult this article: http://zone.ni.com/devzone/cda/tut/p/id/8503

    It has a code snippet that shows passing two parameters to a DLL function.

    But as for your statement that "I don't know how to pass parameter to him", in the example, you reference, you pass a parameter: it's just a constant string rather than a variable.

  • Nested SWF - the function call root

    Hello!

    I'm doing a loaded SWF file to call a function that is in the parent SWF, but it does not work.

    In AS 2.0, I could just put something like _root.myFunction (); and it worked.

    But in 3.0 AS it no longer works.

    Could someone help me, please?

    Thank you!

    Since the main timeline of the swf file that is loaded to the main timeline of the SWF loading, use:

    MovieClip (this.parent.parent) .loadingswfFunction ();

  • Satellite L855 - cannot use the function keys after the Windows 8.1 upgrade

    Hi all,

    After I upgraded my pc Windows 8.1 I can't use special keys use without the FN key.
    In the Toshiba HW setup utility, I put the right option in the tab keybord.

    Can someone help me?

    Thank you

    Before we start discussion tell us please you have upgraded your machine following the instructions of the Toshiba support page?

  • Out of memory when the function call (CopyTabPage)...

    Hello

    I get error "-12 out of memory" when using CopyTabPage (Panel, TAB, 0, Panel, TAB,-1) on my request (the first duplication tab).

    There are several levels of tab panel system (like this example)

    \tab_1 \sub_tab_1
            \sub_tab_2
            ...
            \sub_tab_16
    
    \tab_2  \sub_tab_1
            \sub_tab_2
            ...
            \sub_tab_16
    
    \tab_3  \sub_tab_1
            \sub_tab_2
            ...
            \sub_tab_16
    
    \tab_4  \sub_tab_1
            \sub_tab_2
            ...
            \sub_tab_16
    

    Each sub-tab panels contains appx. 16 x 60 controls (digital, ring, String) and some of them also stripchart graphics.

    I have reached the limit of the CVI? Are there things to check? (I develop under CVI 2012 SP1).

    May - so that someone knows how to fix this?

    Thank you

    George


  • BlackBerry smartphones remove previously missing from the function keys after update

    Just do the new update and now when I go to my Inbox, I was able to 'Delete forward' by using the soft keys. Now, the only way I can delete a bunch of emails I should use the Menu key and tap on delete before. Is there something I'm missing here?

    This is an update, but also how to easy to delete items, as it happened to many people who were accidentally deleting items while the aircraft was in a Pocket

  • The function call error MuseJSAssert: error:

    Hello

    I load my page in Internet Explorer, and I allow ActiveX, I have the error on page message. The page is DepilCentrum | Uvodni stranka

    So, if I as a new project, new page and do only main page of this project, I have same problem.

    Can you help me, please?

    Martin

    Hello Martin,

    Take a look at this screenshot

    The email is a link to http://%3Ca%20href=% 22mailto:[email protected]%22%[email protected]%3C/a%3E[email protected]22% [email protected] %%3C/a%3E what could be the problem

    Edit this link in Muse ' mailto:emailaddress and republish.

    Please let us know the result

  • fist in the function call? and support for 32-bit system?

    Hi, can someone tell me if

    (1) the hearing of 2014 version version "punch in" back? Ive tried hearing cs6 (its great) but jumped to audition 3.0 due to missing punch in.and loop recording.

    (2) position 2014 work on 32-bit systems and a membership is necessary?

    (1) fist in OK kick worked on CS 6 and is always there in 2014 of CC. But automatic loop recording is not in the new version, I think.

    (2) No, hearing of the CC version requires 64-bit system. And yes the latest versions cannot be bought outright. You must have an Adobe Cloud subscription in order to use one of the versions of the software Adobe CC.

  • functions in the document class when the main timeline reached a framework

    Hello

    I have 3 functions in my document class main I want to run when the main timeline reaches a specific frame number.

    How do I do that?

    See the code and comments

    public void mainClass()

    {

    //stage declaraction

    stage.align = StageAlign.TOP_LEFT;

    stage.scaleMode = StageScaleMode.NO_SCALE;

    stage.addEventListener (Event.RESIZE, stageResized);

    wrap these next 3 lines in an if statement so maintimeline currentframe = x

    position().

    loadXml();

    initArrowButtons();

    slideTimer = new Timer (timer_delay);

    slideTimer.addEventListener (TimerEvent.TIMER, nextSlide);

    }

    You can always know what the current picture is by reading currentFrame peoperty:

    public function mainClass() {     addEventListener(Event.ENTER_FRAME, onEnterFrame);}
    
    private function onEnterFrame(e:Event):void {     switch(currentFrame) {          case 1;              frame1Function();          break;
    
              case 2:              frame2Function();          break;
    
              // etc.}
    

Maybe you are looking for