Go Back   kirupaForum > Flash > ActionScript 3.0

Reply
 
Thread Tools Display Modes
Old 11-28-2009, 06:35 AM   #1
wissamboulos
Registered User
MovieClip referencing problem

Hello, I am making a menu in which i want to switch ON the selected submenu and button, and OFF the previous submenu and button, could anybody please tell me what is wrong with my code:

Code:
// Attach events to menu buttons
body_mc.menu_mc.addEventListener(MouseEvent.CLICK, updateSub);

// Declaring the menu elements to update
var previousBtn:MovieClip;
var currentBtn:MovieClip;
var previousSub:MovieClip;
var currentSub:MovieClip;

// Update current and reset previous
function updateSub(event:MouseEvent):void {

    // Only if currentBtn has a value already
    if (currentBtn) {
        previousBtn=currentBtn;
        previousSub=currentSub;
        previousBtn.prevFrame();
    }
    // Update current value
    currentBtn=event.target.parent;
    currentSub=event.target.parent.parent;
    currentBtn.nextFrame();

    // Prevent animation of the same movieclip
    if (currentSub!=previousSub) {
        previousSub.gotoAndPlay("off");
        currentSub.gotoAndStop("selected");
    }

}
What am i missing here, i know previousBtn is not identifying currentBtn before currentBtn is gaining a value, but how is it happening anyway and ignoring the if condition?

Thanks

Last edited by wissamboulos; 11-28-2009 at 07:57 AM..
wissamboulos is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Reply

Tags
menu, movieclip, navigation, reference


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:28 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com