A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: if currentframe is this, then do this

  1. #1
    hey. hey. a-hey-na-ney-na-hey D-von's Avatar
    Join Date
    May 2002
    Posts
    304

    if currentframe is this, then do this

    hey
    i have a flash page basically with a menu, submenu, and content box.

    when you click on links in the menu, sub links in the submenu show up according to what menu link you clicked. then when you click on links in the submenu, the corresponding page shows up in the content box.

    also, when you click on a submenu link, the submenu mc goes to a frame that deactivates the link and puts a dot beside it to signify that that is the page you are currently on.

    so, say i go from a NEWS menu link, click on the submenu CURRENT NEWS, then i click on BIO in the main menu link, the submenu changes to correspond to the menu's current link and the content box stays where it was because the only thing that controls it is the submenu links.
    (i hope i'm making sense)
    the issue is that if i click back to the NEWS menu link, the CURRENT NEWS link is active and the signifying dot is not there because it basically just resetting itself because i went away from the NEWS frame and came back to it.

    I came up with some actionscript that i have no idea if it is correct, but the basics of it is that:
    when you click a menu button, if the content box's current frame is X then, if the submenu is on that same X link, tell the submenu to go to that particular deactivated X link frame. otherwise, tell the submenu to go to the frame where the links are active.

    Code:
    on (release) {
    	if (_root.contentbox._currentframe="news1") {
    		_root.submenumc.submenu.gotoAndStop("news1");
    	} else {
    		_root.submenumc.submenu.gotoAndStop("news0");
    	}
    }
    if anyone can shed a bit of light on this coding issue that would be amazing.
    if i did a good enough job explaining, when you understand, it is actually a simple concept, its just getting the actionscript correct.

    i am using Flash CS3 and actionscript 2

    thanks all

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    for comparison use == not =

    so in your example:

    _root.contentbox._currentframe == "news1"
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  3. #3
    hey. hey. a-hey-na-ney-na-hey D-von's Avatar
    Join Date
    May 2002
    Posts
    304
    that did help a bit, but the whole thing still didn't work. i changed the target from a frame label to just a frame number and it totally works now so thanks. but i really need it to point to a frame label because if anything changes on that timeline, i need it to be as painless as possible and don't want to have to go changing frame numbers in all these scripts. is there something i'm missing again?

    thanks

  4. #4
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    oops yeah currentframe only refers to the frame number, there is no label equivalent unfortunately
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  5. #5
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    _currentframe only returns the number of the frame, not its label.

    you could use a Boolean variable at frame label "news1" -

    bNews1 = true;

    and check for its value on the button action -

    on (release) {
    if (_root.contentbox.bNews1) {
    _root.submenumc.submenu.gotoAndStop("news1");
    } else {
    _root.submenumc.submenu.gotoAndStop("news0");
    }
    }

    set the value to false when you exit "news1"

  6. #6
    hey. hey. a-hey-na-ney-na-hey D-von's Avatar
    Join Date
    May 2002
    Posts
    304
    that helps

    thanks dudes

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