A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [RESOLVED] Problems with Targeting

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    6

    resolved [RESOLVED] Problems with Targeting

    Ok, so I am new to Actionscript, and I am trying to use books and the net to solve my issues, but I occasionally run into these issues I just can't get past. My current one revolves around targeting, but I can't determine if it is a variable assignment problem, or the actual onRelease() function.

    I am using Flash CS4, but I am coding using Actionscript 1/2 (I think - again, I am really new to all of this)

    Here are the relevant variable assignments:

    var history:MovieClip = subMenu_mc.historyButton_mc;
    var smenu:MovieClip = subMenu_mc;
    var tcontent:MovieClip = tContent_mc;


    Obviously, "smenu" and "tcontent" are on the main timeline, but "history" is a MC inside of "smenu".

    Mind you, the next line assigns "smenu" to "subMenu_mc", but I have tried placing the above line before and after the "smenu" assignment (because I am not sure if assigning the variable in a certain order is causing the issue).

    What I am trying to do is make "history" perform like a button, activating an animation in another clip ("tcontent" as seen in code below), but I also want it to make the submenu it is a part of move to another frame. All of the "history" onRollOver and so on behaviors are in the first frame of that individual MC, but I am placing the OnRelease on the main timeline, because it is one of several buttons with similar behaviors, the only difference of which is the actual navigation.

    Here is the OnRelease I am having trouble with:

    history.onRelease = function() {
    _root.tcontent.gotoAndPlay(2);
    _root.smenu.gotoAndStop(1);
    }



    *edit - The problem I am having is that when I view the project (ctrl-enter), clicking the history button does nothing.

    Please help me if you can - it would be greatly appreciated. Also, if anyone can suggest a good super beginner guide to programming in a scripting language, I would also appreciate it - I am looking to expand what I know to a great degree, but it seems like even the beginner stuff I read assumes knowledge here and there that I don't have (such as how "this" is used in targeting - had to look it up )

    I apologize if this is confusing at all, and fully understand if you guys boo me off the boards.
    Last edited by icon2020; 09-04-2009 at 05:28 PM.

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    Regarding your problems with targeting, I recommend Understanding Target Paths.

    If you're serious about ActionScript, and do want to learn, Colin Moock's books are the THE Books.
    But you'll have to decide which version of AS you'll want to start learning... And I wouldn't recommend going backwards, so... go with AS 3.0.

    In order to make sure that the path is correct, trace it:
    PHP Code:
    trace (subMenu_mc.historyButton_mc); 
    Also, notice that if you've already added any of the buttons' behaviors (onRelease, onRollOver, ...) to subMenu_mc, the onRelease() wouldn't work for historyButton_mc because the outer MovieClip "steals" everything.

  3. #3
    Junior Member
    Join Date
    Aug 2009
    Posts
    6
    Thank you VERY much for replying - I will be looking into this asap.

    As for the onRelease, I didn't add it to the historyButton_mc, but I did add the onRollOver and other behaviors. I used this elsewhere and it was working fine, so long as I didn't add any reference to onRelease to it (learned it the hard way in the process). Now that i think about it, though, the difference is that the instance in which it worked had the code referencing a MC on the main timeline, but this one is a level deeper...let me mess with it and I will report back (unless you already know it won't work).

    Thanks again for the info. I'm sure it will be very helpful.

  4. #4
    Junior Member
    Join Date
    Aug 2009
    Posts
    6
    Quick Update: the problem was the fact that the MCs weren't on the first frame of the "smenu" timeline. I used trace to test over and over, and in the process of rebuilding the "smenu" MC from scratch, it occurred to me. All is working now, so thanks!

  5. #5
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    cool!

  6. #6
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    cool!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center