Action Script Buttons Heirarchy Help

This is my first post and im hoping someone out there will be able to help I am a developer in JS and ASP but never learnt actionscript and am completely stuck.
Basically I am using the sliding code from a tutorial i found online, what i want to do is have buttons inside the Content 1, content 2 etc which are basically the pages which are then put into a holder then added to the main scene called CONTENT.SWF, I also have an index.swf which uses a swf loader to bring the CONTENT.swf in, confused yet i am......
The buttons work if i add them to the main scene in Content.swf but not in each of the content1, content2 etc. So i am sure its to do with hierarchy of buttons layers going down or something.
var currentPosition:Number = contentHold.content1._x;
var startFlag:Boolean = false;
menuSlide = function (input:MovieClip) {
                if (startFlag == false) {
                                startFlag = true;
                                var finalDestination:Number = input._x;
                                var distanceMoved:Number = 0;
                                var distanceToMove:Number = Math.abs(finalDestination-currentPosition);
                                var finalSpeed:Number = .3;
                                var currentSpeed:Number = 0;
                                var dir:Number = 1;
                                if (currentPosition<=finalDestination) {
                                                dir = -1;
                                } else if (currentPosition>finalDestination) {
                                                dir = 1;
                                this.onEnterFrame = function() {
                                                currentSpeed = Math.round((distanceToMove-distanceMoved+1)*finalSpeed);
                                                distanceMoved += currentSpeed;
                                                contentHold._x += dir*currentSpeed;
                                                if (Math.abs(distanceMoved-distanceToMove)<=1) {
                                                                contentHold._x = maskMovie._x-currentPosition+dir*distanceToMove;
                                                                currentPosition = input._x;
                                                                startFlag = false;
                                                                delete this.onEnterFrame;
nav.b1.onRelease = function() {
                menuSlide(contentHold.content1);
nav.b2.onRelease = function() {
                menuSlide(contentHold.content2);
nav.b3.onRelease = function() {
                menuSlide(contentHold.content3);
nav.b4.onRelease = function() {
                menuSlide(contentHold.content4);
nav.b5.onRelease = function() {
                menuSlide(contentHold.content5);
nav.b6.onRelease = function() {
                menuSlide(contentHold.content3);

Thanks, but that didnt work for me I did manage to get one button working from within the content1 movieclip  by using the script below.
on(release){
this._parent._parent._parent.container.loadMovie("video.swf");
Just trying to get the code i posted in my first message to work with a button in content 1. I have tried amending the code on the root page from:
nav.b1.onRelease = function() {
    menuSlide(contentHold.content2);
TO
this._parent._parent._parent.nav.b1.onRelease = function() {
    menuSlide(contentHold.content2);
STILL NO LUCK the button instance is b1 , I have even tried adding the script directly to a button.....its driving me crazy...thanks for all your help so far..
on(release){
this._parent._parent._parent.contentHold.content2.b1.menuSlide(this._parent);

Similar Messages

  • How do I Action Script buttons, so the objects lay on the prior object clicked on, in Flash?

    Here's my idea but having problems with the actions scripting:
    Accessories and build your car application in Flash.
    I'm new to the Action Script 3 and I am trying to Action Script my custom graphics for a “build your own car”. Something similar to the Harley Davidson motorcycle builder https://www.harley-davidson.com/en_US/Content/Pages/H-D1/Bike-Builder.html#/locale__en_US/ model__FLD/year__2013
    I have all the graphics (multiple photos, photoshopped and cut out for the different car body colors. I'm doing the same with the car rim choices, etc) All the graphics are sized so they will lay on top of one another seamlessly but I don't know how to Action Script 3 the buttons so you can click on (ex: rim1, or rim2 , etc and see how it looks on car by pulling up the photo on top of the existing background car photo) .
    How would I Action Scrip my "color button" to come up with 10 color swatches I’ve designed and then when you click on the color swatch (ex: red). It will then put the graphic red of the car body that I have already made on top of the existing background photo of the car and so on for each color button?
    Thanks for the help in advance!

    I'm not sure if I do know how to correctly create the Wheels classes and use action scripting. Are the classes you're referring to the parts I labeled btn1, btn2 below? Here's what I have under the main Timeline labeled actions:
    stop() ;
    // Color button code //
    colorbtn.addEventListener(MouseEvent.CLICK, btn1);
    function btn1 (event:MouseEvent) :void{
        gotoAndStop (2);
    // Rims button code //
    rimsbtn.addEventListener(MouseEvent.CLICK, btn2);
    function btn2 (event:MouseEvent) :void{
        gotoAndStop (3);
    //rim1 button code //
    rim1.addEventListener(MouseEvent.CLICK, btn3);
    function btn3 (event:MouseEvent) :void{
        gotoAndStop (4);
    I'm not sure how to fit your code in that you said in your first comment. The //rim1 button code // doesn't currently work.
    I think if I had a sequence of the action script 3 with a button/movie clip layed out for me, I could organize accordingly for my buttons and movie clips. Since they would work the same just would have to have different labels.

  • Action script (if/else) HELP

    hello
    I have this code in my time line
    [quote]:
    var som:Sound;
    som = new Sound();
    som.loadSound(&amp;quot;musica.mp3&amp;quot;);
    som.start(0,9999);
    som.setVolume(20);
    _root.btsom_mc.onRelease = function(){
    var identifica:Number = 0;
    if(identifica == 0){
    som.stop();
    identifica = 1;
    }else{
    som.start(0, 9999);
    identifica = 0;
    [/quote]
    when i click the button it loads the sound above the one is
    playing.. it does not see that the sound is allready playing..
    can someone help me???
    thanks

    Hi again!
    1. var identifica:Number = 0; has to be outside function
    2. check that you have spelled identifica correctly
    everywhere in your version of the code as this is the only possible
    thing that would make the exact results you are having happen.
    3. Try this code - instead of a number, booleans are more
    effective:

  • Action script..PLEASE HELP..

    ...hello guys...i really dont know what to do...i have a drop
    down menu here..it is an xml driven menus...and i want to put a
    scroll bar in the submenus....so even if the submenus will be to
    many..it will not go across the movie....PLEASE HELP.. i am really
    new in actionscripting and i dont have any programming
    backgrown...hope for your response...this a vertical dropdown
    menus....

    The link in your message is also broken.

  • Help with Nav Bar using Action Script 3

    I am a flash NOOB to say the least.  Trying to teach myself.  Thank God for YouTube! LOL!  Anyway, I have build a Nav Bar for a site that has a sliding bar on the bottom of it that follows the mouse.  The problem with this nav bar is that when you change pages inside the site, the slider resets back to position X/Y = 0 and you really don't know what page you are on for sure without me having to identify each page in the page body itself.
    Does anyone know of a way using action script to have the URL of the page sent to flash and in turn use that URL to set the X and Y position of the slider to the appropriate X and Y of the button on the Nav Bar for the page the user is on?
    I have heard of using flash.external.ExternalInterface but now for sure how this really works nor if I can assign it to a variable for reference inside the action script.
    Any help would be appreciated greatly!!

    The Flash Nav Bar is at the top of each page.  But yes, when you click a button inside the flash nav bar it takes you away from your current page and loads a new one.  I am trying to tell the swf file which page it is on so I can set the X and Y position of the slider.
    You will have to excuse me if I am so noob that I loose any of your replies to this as just as Flash is new to me, so is the lingo.
    Thank you for your help.  I will research FlashVar but if you have any other ideas then I am open to them.

  • Action Script?

    Hi All,
    I have create a Application for transaction VA01. Can anybody tell me how to write Action script ?
    Please Help. ASAP.

    Hi,
    Transaction code for action script is WDK_APPL_REG
    1) There you need to register your Variant transaction and specify your floor plan
    either QAF or GAF or OIF in Applications.
    2) You have to spcify your different Floor Plan States like INI, S01, S01, CFN etc.
    3) For Floorplan states you should assign dynpro assignment ( i.e., Program name and screen number ).
    4) And u need to assign actions for every state.
    5) Next go to Script definition and assign action script and u need to record va01 transaction with SHDB, and submit program, dynpro, bdc filed value in batchinput data.
    6) If u want to raise any messages, click on Message Mapping and submit message name and number.
    Finally you need to save your action script.
    Best Regards,
    Vara Prasad.

  • Can't add action script to my buttons, need help

    I'm trying to add action script to my buttons to link them but the script menu has the message "Current selection cannot have actions applied to it" Why is this happening?
    see attached

    Okay,
    I have a page where I have a button that states "PRODUCTS". I need to get
    the button to send the user to another page called "products.swf
    (products.fla)". What script to I insert in the actions menu?
    Thanks
    Derrick Young - Graphic Designer, Art Dept.
    (d) 403.250.4261 | (f) 403.250.4336 | www.calgarysun.com
    (e) [email protected] | (a) 2615 12th Street N.E., Calgary, AB
    T2E 7W9

  • Flash Newbie needs help with Movie Clips/Action Scripting

    Hi -
    I'm having a problem with my movie clips playing
    simultaneously and cannot, for the life of me, figure out what I
    have done wrong. I'm new to flash, so I may have set something up
    incorrectly, but here's what I have so far:
    11 layers, total: 1 layer with 10 control buttons, each
    button with the following actionscript:
    on (release) {
    gotoAndPlay(85);
    Where the number changes in relation to which keyframe the
    next movie is on.
    I have 10 movies, total, but they are only movie clips,
    essentially photo slide shows with audio, made all in the library.
    The problem happens when I click on the second or third
    button. Not only does the movie that I have selected begin to play,
    but all of the previous clips do as well, so it all sounds quite
    garbled. I don't know what I am missing in the action script, as my
    Action Layer has a stop command on it at each keyframe where there
    is a new clip to play.
    I have tried to add a stopAllSounds command, but I'm afraid
    that doesn't do anything because it is not a "sound file" per se,
    playing in the timeline.
    I'm at the end of my rope and really need some help in
    figuring this one out. My project is hanging in the balance on
    this, as I have scripted everything else correctly and it runs
    beautifully.
    Please help!
    Thanks,
    Caroline

    Each layer has a blank keyframe before and after each
    movieclip. Each movie clip is at a different frame. Even with the
    blank keyframes added, the second video starts to play and then the
    first video begins to play. Same happens if I click on the third
    button. Third plays, and starts 1st and 2nd shortly thereafter. Is
    there an action script I can put in that will tell the timeline
    that, when a button is clicked, no matter where the movieclip is,
    it will stop and start the newly selected movieclip?

  • Buttons and Action script 3

    I have purchased Flash CS3 and have created a small
    animation. I would like the user to press the button in order for
    the animation to play. With the previouse version of flash I would
    drag the button onto the stage open the action script window and
    start entering the script e.g. on(release){gotoandPlay(5);}
    However with the new version I cannot write scripts for the
    buttons.... I am confused or am I missing something? Please help me
    out.

    you're missing actionscript3. and if you don't care to learn
    and use it, just use the actionscript2 publish settings and use
    actionscript2 coding in your projects.

  • Flv xml Stream Playlist action script help

    So if you go to this site:
    click here
    you will see a FLV player that has a list of videos that are
    pulled from a .xml file...
    The action script for this player is as such:
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    var ns:NetStream = new NetStream(nc);
    theVideo.attachVideo(ns);
    rewindButton.onRelease = function() {
    ns.seek(0);
    playButton.onRelease = function() {
    ns.pause();
    var videoInterval = setInterval(videoStatus,100);
    var amountLoaded:Number;
    var duration:Number;
    ns["onMetaData"] = function(obj) {
    duration = obj.duration;
    function videoStatus() {
    amountLoaded = ns.bytesLoaded / ns.bytesTotal;
    loader.loadBar._width = amountLoaded * 194.5;
    loader.scrub._x = ns.time / duration * 194.5;
    var vlist:XML = new XML();
    vlist.ignoreWhite = true;
    vlist.onLoad = function() {
    var videos:Array = this.firstChild.childNodes;
    for(i=0;i<videos.length;i++) {
    videoList.addItem(videos
    .attributes.desc,videos.attributes.url);
    ns.play(videoList.getItemAt(0).data);
    videoList.selectedIndex = 0;
    var vidList:Object = new Object();
    vidList.change = function() {
    ns.play(videoList.getItemAt(videoList.selectedIndex).data);
    videoList.addEventListener("change",vidList);
    vlist.load("videos.xml");
    I want to action script something that will make the videos
    play one after the other, get rid of the list on the right and have
    buttons on player that allow you to go to the next/previous video
    listed in the .xml file
    Its sort of like the player at
    click
    here
    I know this is a lot to ask, but I am currently in a jam and
    any help would be greatly appreciated...
    Thanks
    Matthelm88

    gotoAndLearn is a fantastic base to build off of.
    but
    i'm looking for the same thing... how do you get the files
    to play one after another?
    i've looked for everyhting ns. related and i can find any
    doc's on this one.
    i 've found the
    function complete_listener(eventObject:VideoEvent):void {
    if (my_FLVPlybk.source == "rentv1.flv") {
    my_FLVPlybk.play("rentv2.flv");
    else if (my_FLVPlybk.source == "rentv2.flv") {
    my_FLVPlybk.play("rentv3.flv");
    on the flash video live docs.. but i can't find anything on
    how to tie it into the XML.
    anything anyone can offer would be a huge help ...

  • Having trouble adding action script to button symbol

    Hello everyone:
    I am hoping someone will read this as I am a developer in
    'dires straits' with Flash ( a newbie). My problem regards a
    layer called "button" which has already been converted to symbol
    and turned into an invisible button. The problem lies when I try to
    use the selection tool to select it so that I can add action script
    to it. Instead of the actions dialogue box saying "actions-button",
    it says "actions-frame", and as a result, the action script doesn't
    work. I don't know what to do, it should be simple to select it but
    something is wrong. If you feel a need to help a developer in need,
    you can email me at [email protected], and I can e-mail
    you the file so that you can help. Thanks, or you can call me at
    310-867-5167
    Corinna

    Can you plant the fla file on a server and provide a link to
    it? Zip it up first if possible.

  • Problem with action script to button

    Hello all.
    I'm having a problem with my adobe flash CS3 action script. My button cant link to the other URL. I tried to put an action script but i fail. anyone can help me? here the attachment for my flash document.

    HELLO,
                  just check       navigateToURL()

  • Problems adding  url link to buttons in action Script 3

    each time I added it link 1 to the button on file i get these error messages-  
    1046: Type was not found or was not a compile-time constant: link1.
    1180: Call to a possibly undefined method link1.
    Warning: 3594: exec is not a recognized method of the dynamic class RegExp. var r:Object = p.exec(s);  
    This is the code I am using:   import flash.net.navigateToURL; import flash.net.URLRequest;  var link_one:link1;  link_one = new link1(); stage.addChild(link_one);  link_one.addEventListener(MouseEvent.CLICK, buttonClickHandler);  function buttonClickHandler(event:MouseEvent):void { var url:String = "http://www.masterpiececorp.com/ARMREF.htm"; var request:URLRequest = new URLRequest(url); navigateToURL(request); }    I have no other problems with link 3 or 4, just link 1  I still cannot get my urls link to movie clips on the flash  
    Can you upload flash here? if not I have a image capture I can use to have you look at my buttons  and action script code. i have been to every forum I know and not any have been helpful at all. This is my last hope.
    Very frustrated newbie  Gina T
    Message was edited by: gtaylor0406

    The way you had your code originally would be correct...
    var link_one:link1;
    link_one = new link1();
    addChild(link_one);
    The 1046 error is indicating it doesn't recognize the link1 class.  So the first thing you need to make sure of is that you have assigned the link1 class designation to whatever symbol that is in the library.

  • Help with Action script 2.0 please

    Hi,
    I am new to actionscript and i could really do with some help
    please. I am trying to load external movie clips into two different
    containers depending on which button is clicked. Sometimes there
    may be two conatiners attached to a buuton click, whilst other
    buttons may only need to load one movie clip. Here is the action
    script i have been using:
    button1.onPress = function () {
    _root.createEmptyMovieClip("container", 1);
    _root.createEmptyMovieClip("container1", 2);
    unloadMovie("container1");
    loadMovie("scene2.swf", "container");
    loadMovie("scene5.swf", "container1");
    container._x = 50 ;
    container._y = 110 ;
    container1._x = 170 ;
    container1._y = 5 ;
    button2.onPress = function () {
    loadMovie("scene6.swf", "container");
    unloadMovie("container1");
    container._x = 50 ;
    container._y = 110 ;
    This does load the movies, however i have to press button one
    first before button two will work. Ideally i need to be able to
    call any movieclip at any time. Can anyone tell me where i am going
    wrong?

    quote:
    Originally posted by:
    NedWebs
    Try moving these lines outside of the button function:
    _root.createEmptyMovieClip("container", 1);
    _root.createEmptyMovieClip("container1", 2);
    You can use "this" instead of "_root"... that'll save any
    problem if you ever move this within some other movie. Also, move
    the x/y assignments just under those lines since they relate to
    them directly.
    Hey thankyou for your help, that works now. although if i
    move the x and y assignments i would have to create another
    container right? Thanks again for your help.

  • How do I use the button states in an action script?

    In my Captivate 8 project I use smart shape as buttons. The buttons have different images presented dependent on the state of the button. I have also created a simple action script that shows what happens when the button is pressed. When the button has been pressed the normal state of the button appear. I, however, want the down state of the button to remain visible util the user presses another button. How do I accomplish this? Is there variables for the buttons different state or how can I create that?
    BR,
    Madeleine

    When you talk about 'actionscript' do you mean advanced or shared actions? You cannot write actionscript within Captivate, only Javascript. If you use advanced/shared actions they'll be converted on runtime to either Actionscript (for SWF output) or Javascript (for HTML5 output).
    The states in shape buttons are the normal way buttons behave (not only in Flash). If you are indeed using shared/advanced actions, and you want the down state to remain until the next shape button is clicked, you'll have to go the way described by iFlashAppsToo. Create shapes that have the look of the down state, make them initially invisible and group all those shapes on one slide. Add two statements to the shared/advanced action (please do use shared actions, you'll save time):
    Hide Group   so that eventual down mimicked states on previously clicked buttons disappear
    Show Im_Downx    to show the down image for that button

Maybe you are looking for