Pages.gotoAndStop (event.target.name);

I followed this tutorial

http://www.YouTube.com/watch?v=AhsSQGcm46E

I make a Web site with buttons but when I test the scene it scrolls and loops of each content page.

This is the code I have for action script


var myMenuArray = [which, video, photography, Web design];
for each {(var btn in myMenuArray)

btn.addEventListener (MouseEvent.CLICK, onBtnClick);

}
function onBtnClick(event:MouseEvent):void {}


Pages.gotoAndStop (event.target.name);
}

When I test the scene, he said.

1061: call to a Stop method maybe not defined through a reference with static type fl.motion:AnimatorFactory.

Any ideas?

The error would give the impression that Pages is not an object with a timeline

Tags: Adobe Animate

Similar Questions

  • instances of addChild does not recognize event.target.name?

    I have a button that has been added to the stage using addChild when the page load, the button is supposed to be removed using removeChild and redirect in its specific page using event.target.name... somehow, I got this error:

    Error #2044: Unmanaged by the IOErrorEvent:. Text = Error #2035: URL not found.

    I try to replace this line.

    var newswf:URLRequest = new URLRequest (".") ("/ swf /" + event.target.name + ".swf");

    with that,.

    var newswf:URLRequest = new URLRequest("./swfs/about.swf");

    and everything works fine, but I don't want that since I want to dynamically load and use less code... is there a solution to do this, thanks for the help

    my code as below:

    //////////////////////////////////////////////////////////

    var subject: About = new About().

    about.x = 300;

    about.y = 200;

    addChild (about);

    function btnClick2(event:MouseEvent):void {}

    removeChild (about);

    removeChild (loader);

    var newswf:URLRequest = new URLRequest (".") ("/ swf /" + event.target.name + ".swf");

    Loader.Load (newswf);

    Loader.x = XPos;

    Loader.y = YPos;

    addChild (loader);

    SoundMixer.stopAll ();

    to stop all the background sound when click

    }

    about.addEventListener (MouseEvent.CLICK, btnClick2);

    //////////////////////////////////////////////////////////////////////////

    I missed the part where you create dynamically on the Forum...  You must assign a name because the name property is not the same as the var with that you instantiated...

    var subject: About = new About().

    about. Name = "a connection";

  • Helps the event.target.name

    I'm very green with actionscript and coding in general so please forgive me if I ask you something that sounds super easy.

    Is it possible to take the "event.target.name" value, which in my case would be something like 'SW5005_mc' and change this value.

    I use this value now to tell another clip of gotoAndStop (event.target.name); I have identical to the event.target.name marked images.

    I would like to take the value of event.target.name for example "SW5005_mc" and delete the "_mc" and put a dash between the 'SW' and the '5005.

    for "SW-5005" and then I'd spend it in a text field.

    I don't really know where to start, or if this is possible.

    Thanks for any help or suggestion,

    Chris

    You can use String.indexOf to find the _ and just get everything entered, then use substr and substring for the rest:

    var a: String = event.target.name;
    var b:String = a.substring (0, a.indexOf ("_")); get the front part of the _
    var c:String = b.substr (0.2) + "-" + b.substr (2); Insert a - between the first two characters and the rest
    trace (c);

    SW-5005

  • How to use event.target.name in AS2?

    Thanks kglad, I could see how event.target.name in AS3 could make a button to load a movieclip with the same name.

    I do the same thing now in AS2, but don't know what to write instead of event.target.name.

    And so, at the present time, each button push information in a table and then a function that uses to decide what movieclip to tie to a holder after that he faded once and then fades new...

    BEGINNING OF THE GALLERY OF IMAGES *.
    Add images to the holder
    imgholder.attachMovie ("img0", "image0_0", 1).

    Table
    var nextLoad = ['img0'];

    Listeners of BTN
    img5.onRelease = function() {trace (nextLoad); nextLoad.pop (); nextLoad.push ("img5"); btnClick()} / / written on 1 line
    img4.onRelease = function() {trace (nextLoad); nextLoad.pop (); nextLoad.push ("img4"); btnClick()}
    img3.onRelease = function() {trace (nextLoad); nextLoad.pop (); nextLoad.push ("img3"); btnClick()}
    img2.onRelease = function() {trace (nextLoad); nextLoad.pop (); nextLoad.push ("img2"); btnClick()}
    img1.onRelease = function() {}
    nextLoad.pop ();
    nextLoad.push ("img1");
    btnClick()
    }
    img0.onRelease = function() {}
    nextLoad.pop ();
    nextLoad.push ("img0");
    btnClick()
    }


    The function of btn
    function btnClick() {}
    trace ('click');
    var myImgTween:Object = new Tween (imgholder, "_alpha", Strong.easeOut, 100, 0, 1, true ");
    myImgTween.onMotionFinished = function() {}
    fadeOutImg();
    }
    }

    The function part of II btn
    function fadeOutImg() {}
    trace ("fadeOutImg");
    imgholder.attachMovie (nextLoad, "image1_1", 1);
    var myImgTween:Object = new Tween (imgholder, "_alpha", Strong.easeOut, 0, 100, 1, true ");
    }

    I know I should be able to push the button name in the table, but I meet to use a string... I don't know that my code is heavy! But it works. I tried to push as the name of the button but it end by including the reference to full step.
    Is there a cleaner way to do this using event.target.name?
    Thanks for the research!

    There is no event.target in AS2. However since AS2 has no way to remember the scope object where the target object, you can use this to your advantage to get the name of the target using the command 'that' in the function when you use the format above "mc.onPress = myfunc". FYI, the delegate popular workaround solution, enabled when you called 'this' in the function, you can retrieve the scope object where the target instance. So without her help, "this" will return the name of the target object. In any case, this is the code that you can use:

    imgholder.attachMovie("img0","image0_0",1);

    var nextLoad = ['img0'];

    img5.onRelease = onImgRelease;

    img4.onRelease = onImgRelease;

    img3.onRelease = onImgRelease;

    img2.onRelease = onImgRelease;

    img1.onRelease = onImgRelease;

    img0.onRelease = onImgRelease;

    function onImgRelease (): Void {}

    nextLoad.pop ();

    nextLoad.push (this._name);

    btnClick();

    }

    The function of btn

    function btnClick() {}

    trace ("Click");

    var myImgTween:Object = new Tween (imgholder, "_alpha", Strong.easeOut, 100, 0, 1, true ");

    myImgTween.onMotionFinished = function() {}

    fadeOutImg();

    }

    }

    The function part of II btn

    function fadeOutImg() {}

    trace ("fadeOutImg");

    imgholder.attachMovie(nextLoad,"image1_1",1);

    var myImgTween:Object = new Tween (imgholder, "_alpha", Strong.easeOut, 0, 100, 1, true ");

    }

  • How to use the String with an external dispatchEvent event.target.name?

    ... I hope that the question of the title makes sense...

    On my stage, I have an external SWF loaded with a button. When you click the button dispatches the main event scene.

    On the main stage a listener can load a SWF it in a magazine called Gallery.

    The charger of the Gallery is also shared by the buttons on the main stage, who use the event.target.name chain to appeal to sovereign wealth funds with corresponding names.

    I use tweens to fade and, in the content of the Gallery when a key is pressed.

    --

    Loading of the FSV worked until I tried to create a universal function for the dispatchEvent buttons...

    The problem I have is that I don't know how to set the string to indicate to the newSWFRequest where the SWF file when triggered by external buttons.

    (I maybe do this wrong... but thought that the best way to load a SWF on the main stage from an external SWF was using dispatchEvent?)

    My code raises the event and the charger of the Gallery Faints, but then it does not find the new SWF:

    Error #2044: Unmanaged by the IOErrorEvent:. Text = Error #2035: URL not found.

    Please can someone help me understand how to make the point in the chain in the right direction? (I think that the errors only are in bold below)

    Code:

    var myTweenIn2:Tween;

    var myTweenOut2:Tween;

    var nextLoadS2:String;

    Listening external inclinometer shipped external event

    addEventListener ("contactStage", btnClickExtrnl);

    function btnClickExtrnl(e:Event):void {}

    nextLoadS2 =?

    myTweenOut2 = new Tween(gallery,"alpha",None.easeOut,gallery.alpha,0,0.2,true);

    myTweenOut2.addEventListener (TweenEvent.MOTION_FINISH, tweenOutCompleteF2);

    }

    Function universal BTNS

    function tweenOutCompleteF2(e:TweenEvent) {}

    myTweenOut2.removeEventListener (TweenEvent.MOTION_FINISH, tweenOutCompleteF2);

    myTweenOut2 = null;

    var newSWFRequest:URLRequest = new URLRequest ("SWFs /" + nextLoadS2 + ".swf");

    myTweenIn2 = new Tween (Gallery, "alpha", None.easeOut, gallery.alpha, 1, 0.2, true);

    Gallery.Load (newSWFRequest);

    Gallery.x = Xpos;

    Gallery.y = Ypos;

    }

    Thank you.

    If this code is on the timeline of a child of the main timeline of your external swf add parent 3rd in two lines with parent.parent.

  • By the way the target name of the event to the text field

    Hello

    I'm new to 3.0 and can use some help here... should be easy for you, experts...
    I just need to target an event name to a text field:

    square.addEventListener (MouseEvent.MOUSE_DOWN, downObj);

    function downObj(event:MouseEvent) {}
    targetObj = event.target;
    mydrag. Visible = true;
    targetObj.startDrag ();
    mydrag.addEventListener (Event.ENTER_FRAME, dragClip);
    target_txt. Text = String (event.target);
    }

    I also tried:
    target_txt. Text = event.target;
    but no luck so far...

    Any help would be much appreciated.
    See you soon...

    Bruno Aun
    Flash + Coldfusion Developer
    http://www.BrunoAun.com

    It's true...

    target_txt. Text = String (event.target .name);

    works like a charm.
    Thank you!

  • event.target.buttonImportIcon ();

    First of all, let me say that I know just enough to be dangerous... so please be nice.

    FYI - I have Acrobat, full paid, more up-to-date version.

    I created a form and in this form, I have several boxes for the insertion of photos. I use the script event.target.buttonImportIcon (); to insert pictures. I am aware that in the free version, only the PDF files may be inserted. However, I have the full version. When the box opens for me to find the picture to be inserted, it takes by default showing only PDF files. I can change it to jpg and browse, but it is heavy, because every time I have to complete this form, I need to send pictures of 12-18 for documentation.

    My question is, is there a way so that the box which opens all to display jpg files? Or at least to show all file extensions? I know that this is not a huge deal, but I do 3 to 5 of these forms per day, with pictures of 12-18 each, so it would be nice not to change the file type, I'm looking at every time.

    Thanks a lot for your help!

    Someone asked more information, so here's a more complete script which can be placed in a folder level JavaScript file:

    var ASGJ_buttonImportIconAll = app.trustedFunction(function (doc, f_name) {
    
        // Get a reference to the specified field
        var f = doc.getField(f_name);
    
        // If the specified field does not exist...
        if (!f) {
    
            app.beginPriv();
            app.alert({
                cMsg: "The specified field [" + f_name + "] does not exist.",
                nIcon: 0,  // Error icon
                nType: 0,  // OK
                cTitle: "Field does not exist"
            });
            app.endPriv();
    
            return;
        }
    
        // If the specified field is not a button...
        if (f.type !== "button") {
    
            app.beginPriv();
            app.alert({
                cMsg: "The specified field [" + f_name + "] is not a button.\r\rField type: " + f.type + "\r\rCannot import icon.",
                nIcon: 0,  // Error icon
                nType: 0,  // OK
                cTitle: "Field is not a button"
            });
            app.endPriv();
    
            return;
        }
    
        // If the button layout is label only...
        if (f.buttonPosition === position.textOnly) {
    
            app.beginPriv();
            app.alert({
                cMsg: "The specified button [" + f_name + "] has a Text-only layout.\r\rCannot import icon.",
                nIcon: 0,  // Error icon
                nType: 0,  // OK
                cTitle: "Button layout is text-only"
            });
            app.endPriv();
    
            return;
        }
    
        // Prompt user to select a file to use as the source for the button icon
        app.beginPriv();
        var oFilespec = app.browseForDoc({
            cFileFilter: 2,
            cWindowTitle: "Select an image"
        });
        app.endPriv();
    
        // Deal with the selected file
        if (typeof oFilespec !== "undefined") {
    
            // Attempt to use the selected file as the source of the button icon
            app.beginPriv();
            var nReturn = f.buttonImportIcon({
                cPath: oFilespec.cPath
            });
            app.endPriv();
    
            switch (nReturn) {
            case -1 :
                app.beginPriv();
                app.alert({
                    cMsg: "The selected file: " + oFilespec.cPath + "\r\rcould not be opened." ,
                    nIcon: 0,  // Error icon
                    nType: 0,  // OK
                    cTitle: "Cannot open selected file"
                });
                app.endPriv();
                break;
            case -2 :
                app.beginPriv();
                app.alert({
                    cMsg: "The selected page is invalid.\r\rCannot import icon.",
                    nIcon: 0,  // Error icon
                    nType: 0,  // OK
                    cTitle: "Selected page invalid"
                });
                app.endPriv();
                break;
            default :
                // Import was successful or user canceled
                // so there's nothing to do
            }
    
        }
    
    });
    

    The function can be called like that in the mouse event to the top of a button:

    ASGJ_buttonImportIconAll(this, event.target.name);
    
  • Event.Target confusion?

    I try to reuse the function using event.target, but after research and try different method online, I found event.target belongs to the most difficult to understand part...

    can someone explain to me what is the difference between (the example to the right indicating where I meet these code):

    1.event.target

    2.event.target.name

    3.event.currentTarget / / e.g. event.currentTarget.addChild (myMc);

    4.event.currentTarget.name / / e.g. var newswf:URLRequest = new URLRequest (event.target.name + ".swf");

    5 MovieClip (event.currentTarget) / / e.g. addChild (MovieClip (event.currentTarget));

    I consider that the main culprit for the compiler and whoever decided to dumb it upward.  If you try what suggest you and manually place circles on the scene, you will probably see the same mistake to shut up... even if the circle is a resource of the library which is defined as a symbol of the MovieClip that the compiler must be able to refer to.

  • Event.Target.Child?

    I placed the bitmap image into a container. the container has its listeners.

    When I mouseOver, I get the right container (event.target.name).

    now, I want the alpha thumbBMP the value 1 when above him. Event.Target.Child... but is not a result

    What did I miss?

    function overThumb(event:MouseEvent):void {}

    trace (Event.Target.Name); thumbContainer name

    trace (event.target.child); undefined?

    }

    var thumbBMP:Bitmap = new bitmap;

    var thumbContainer:MovieClip = new MovieClip();

    thumbBMP.alpha = 0.75;

    thumbContainer.addChild (thumbBMP);

    thumbContainer.addEventListener (MouseEvent.MOUSE_OVER, overThumb);

    thumbContainer.addEventListener (MouseEvent.MOUSE_OUT, outThumb);

    in fact, how can you still test that?  nothing is on stage to receive mouse events.  and, there is no such thing as a property of the child.  Use getChildAt() or getChildByName()

  • run event.target from a page 1 button to run on page 4 of the form

    Hello

    I currently have a button on page four of the form which takes place this javascript.

    If (event.target.value! = 'Off') {}

    this.getField("strike5").display = display.visible;

    } else {}

    this.getField("strike5").display = display.hidden;

    }

    If (event.target.value! = 'Off') {}

    this.getField("strike6").display = display.visible;

    } else {}

    this.getField("strike6").display = display.hidden;

    }

    //

    If (event.target.value! = 'Off') {}

    this.getField("strike7").display = display.hidden;

    } else {}

    this.getField("strike7").display = display.visible;

    }

    If (event.target.value! = 'Off') {}

    this.getField("strike8").display = display.hidden;

    } else {}

    this.getField("strike8").display = display.visible;

    }

    I wish now to turn by a button on page 0 to do the same on page four.

    Is this possible?

    I hope so... See you soon

    I would create a document-level function to adjust the display of the fields when the box of cehck is not equal to 'Off '.

    function SetStrikeDisplay (cValue)
    {
    Set the fields to display when the value is 'Off' to the default value;
    this.getField("strike5").display = display.hidden;
    this.getField("strike6").display = display.hidden;
    this.getField("strike7").display = display.visible;
    this.getField("strike8").display = display.visible;
    If (cValue! = "Off")
    {
    this.getField("strike5").display = display.visible;
    this.getField("strike6").display = display.visible;
    this.getField("strike7").display = display.hidden;
    this.getField("strike8").display = display.hidden;
    }
    return;
    } / / end of function SetStrikeDisplay;

    For each field, you want this script to run to use the following code:

    SetStrikeDisplay (event.target.value);

  • testbox. Optimization of event.target listener and event name

    Is it possible to get the name of a TextBox of event.target?

    stage.addEventListener (MouseEvent.MOUSE_DOWN, clickHandler);

    function clickHandler(e:Event):void {}

    trace (e.Target.Name);

    }

    out to click on a text box is

    instance1111

    I am creating a clickHandler which takes care of everything by checking the name of which was clicked on instead of adding individual headphones to each object.

    (added)

    Another solution that I thought would be to separate the text and turn it into an object, but I prefer not to do that if it can be helped.

    (question 2)

    I worked on a menu, when you click on something it becomes visible and adds / removes event listeners to each button you change your location.

    Switching between menus causes a noticeable pause, which made me think to spend the 1 Manager of.

    Is there a reason to not just leave the active event listeners?  Even better if I can get the above responded and have 1 single active listener to the menu instead of 30.

    In order to get the name of the event.target text box you need

    Event.Target.parent.parent.Name

    A text box consists of 2 subobjects.

    (added)
    Your comment about having children made me put 2 and 2 together.  Initially, I tried e.target and she came back with TextLine, didn't think about it being a "child" until your comment.

    trace (e.Target); TextLine

    trace (e.Target.parent); Sprite

    trace (e.Target.parent.parent); TLFTextField

  • Remove the MovieClip with event.target.content

    Hi everyone please I need your help I have this code and I want to delete baresClip but I cante removeit Please helpme

    var loaderBares:Loader = new Loader();

    loaderBares.unload ();

    loaderBares.load (new URLRequest("negocio/bares.swf"));

    loaderBares.contentLoaderInfo.addEventListener (Event.COMPLETE, loadBares);

    function loadBares(event:Event) {}

    var baresClip:MovieClip = event.target.content;

    baresClip.x =-474;

    baresClip.y = - 135;

    addChild (baresClip);

    baresClip.over1.receta1.addEventListener (MouseEvent.CLICK, prueba);

    function prueba(event:MouseEvent):void {}

    gotoAndStop ("receta1");

    removeChild (baresClip); / * Here is work * /.

    }

    MovieClip (root),.mc_negocio.menu_negocio.btn_botanas.addEventListener (MouseEvent.CLICK, goToBotanas);

    function goToBotanas(event:MouseEvent):void

    {

    removeChild (baresClip);   / * Here is not work * /.

    gotoAndPlay ("botanas");

    }

    Oh, I see what you're doing.  you entered baresClip local loadBares.

    to remedy this, use:

    var baresClip:MovieClip

    var loaderBares:Loader = new Loader();

    loaderBares.unload ();

    loaderBares.load (new URLRequest("negocio/bares.swf"));

    loaderBares.contentLoaderInfo.addEventListener (Event.COMPLETE, s loadBare);

    function loadBares(event:Event) {}

    baresClip = event.target.content;

    baresClip.x =-474;

    baresClip.y = - 135;

    addChild (baresClip);

    baresClip.over1.receta1.addEventListener (MouseEvent.CLICK, prueba);

    function prueba(event:MouseEvent):void {}

    gotoAndStop ("receta1");

    removeChild (baresClip); / * Here is work * /.

    }

    MovieClip (root).mc_negocio.menu_negocio.btn_botanas.addEventListener (ouseEvent.CLICK, goToBotanas M);

    function goToBotanas(event:MouseEvent):void

    {

    removeChild (baresClip);   / * Here is not work * /.

    gotoAndPlay ("botanas");

    }

  • Problem led the TweenEvent event.target

    Hello

    The logic of the code is as follows (pseudo):

    function X {}

    switch

    (1) tween1-> tween finishing launch onTweenFinish();

    (2)-> finishing launch onTweenFinish() tween tween2;

    (3) tween3-> tween finishing launch onTweenFinish();

    ]

    and now AS3:

    int onTweenFinish(e:TweenEvent):void

    {

    trace ("Motion event triggered");

    trace (e.Target.Name);

    }

    results in: ReferenceError: Error #1069: the property name not found on fl.transitions.Tween and there is no default value.

    What I want is to treat all the interpolations of three in one function, but I need to know what tween it was. It is of course possible to make three separate functions, one for each tween, but it's just not good.

    Any suggestions?

    Thank you

    Maxim.

    You could test to see who it is...

    function onTweenFinish(e:TweenEvent):void

    {
    if(e.currentTarget == tween1) {}
    trace ("tween1 triggered event");
    } else if(e.currentTarget == tween2) {}
    trace ("tween2 triggered event");
    } etc...

    }

  • Event.Target and nested clips

    Hey all,.


    Here's my dilemma; I have a bunch of video clips in my main timeline with at least 2 nested clips inside them, MyMc.nested1.nested2 etc.
    I gave the top most video clips that rely on the main timeline instance names.
    In a document class that I created a private variable typed as an array and placed all these MC names in this table.
    I then loop through the length of the array and assigned 2 event for each instance listeners.
    Example:

    for (var i: uint = 0; i < _activities.length; i ++)
    {
    _activities [i] .buttonMode = true;
    _activities [i] .addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    _activities [i] .addEventListener (MouseEvent.MOUSE_UP, dropIt);
    }

    in the event pickup() is were my problem seems to be coming.
    In the microphone function, I have the following:

    event.target.startDrag)

    It seems to work, but only on the lowest nested movie clip... nested2
    I can use event.target.parent.parent.startDrag () and that seems to work... Except when I place an another movieclip in the second layer of the of the MyMC, if it is accidentally clicked, it will now slide on the stage.
    I tried to use event.target.mouseChildren = false, but that doesn't seem to work on the lowest nested object... nested2 as this seems to be one I'm clicking
    Is there something that miss me to say, click only the mc at a higher level, and then ignore all nested mc?

    Thank you

    Try to use: "event.currentTarget" and you can also set 'mouseChildren = false' on the clip you want to move (but what to put in a function init, not the mouse Manager).

  • HTTP vs event.target.submitForm Submit button

    Dear all,

    I have a problem that looks like, I need expert help to the resolve.

    I have designed a form with Acrobat, LiveCycle Designer ES 8.2

    The plan is people to fill out the form and submit it to a script on a web page.

    That is the problem.

    When I insert a normal button of HTTPSubmit. This medication works very well. All fields in th are sent, and I can treat them with my script.

    However, when I try to make a normal button and add javascript for the click event.

    event.target.submitForm ({cURL: "http://mysite/myscript.php", cSubmitAs: "HTML", cCharSet: "utf - 8"});

    The form is sent, but no fields are.

    As an example of the output of the APPLICATION of table in PHP.

    With the regular HTTP submit button, I get:

    Table
    (
    [familyname] = > 1
    [SubjectNumber] = > 2
    [Site] = > 3
    )

    So that the JavaScript file above, I get:

    Table
    (
    [form1] = > Array
    (
    [0] = >
    )

    )

    It looks that the JavaScript file I somehow can not present the actuall fields.

    Finally, let me tell you the reason why I still want to use Javascript instead of the regular HTTP Submit button.

    My plan is so people can actually change the location where to send the form.

    From what I've read if I use a single submit button, the URL must be hard-coded and cannot be changed (selected by the user dynamically)

    Whereas if I use javascript so I can easily have a text field where people can enter the site where they want to submit the form and use it.

    Thank you very much for your help

    Please let me know if you need additional information

    Concerning

    Tsvyatko

    Actually I think you can set the url of a "submit" button.  Try using the following FormCalc code:

    submitbuttonname.event__click. #submit. #target

    = the string entered by the user

    The string entered by the user must include "http://" in the front, e.g. http://www.google.com

    As long as the code above is executed before pressing the button submit, you should be OK.  I have not worked on the JavaScript syntax.

Maybe you are looking for