Go Back   kirupaForum > Flash > ActionScript 3.0

Reply
 
Thread Tools Display Modes
Old 11-28-2009, 09:23 PM   #1
SumYungGai
Horrible Actionscripter
 
SumYungGai's Avatar
Location The middle of frickin nowhere

Posts 75
Need hewp with groups of buttons

swf: http://www.experimentalflash.com/res...Chemistry1.swf

So I have this WIP for a chemistry game. If you press the atom, then the wooden beam like button…you will see a group of buttons all labeled 1-20 denoting levels. I’ve tried a lot of stuff to get these buttons to work, but I can’t seem to figure out how to pass the level they denote to the next frame…the frame with the actual game in it. (Which at the moment is the solution to some level)

What would be the easiest way to tell the next frame what level I want, based on which button I press? Also, should I make a Listener for the stage, or for each button itself?

Also…why are the text boxes inside the buttons messing with the hand cursor icon?

Lol...hewp...Just noticed that

__________________
www.ExperimentalFlash.com - Crappy games, crappy toons, and other crappy stuff. Take a few minutes out of your crappy day to go there .

Last edited by SumYungGai; 11-28-2009 at 09:59 PM..
SumYungGai is offline   Reply With Quote

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

Old 11-28-2009, 11:33 PM   #2
SumYungGai
Horrible Actionscripter
 
SumYungGai's Avatar
Location The middle of frickin nowhere

Posts 75
My code is...

ActionScript Code:
var slidingTilesButtons:MovieClip = new MovieClip();
stage.addChild(slidingTilesButtons);

var rootLevel:Number;

function createButtons() {
    for (var i:Number = 0; i < 4; i++) {
        for (var j:Number = 0; j < 5; j++) {
            var STLB:SlidingTilesLevelButton = new SlidingTilesLevelButton();
            slidingTilesButtons.addChild(STLB);
            STLB.name = "STLB-" + (i * 5 + j);
            STLB.levelNum = (i * 5 + j + 1)
            STLB.level_txt.text = String(STLB.levelNum);
            STLB.x = 100 + 60 * j;
            STLB.y = 60 + 60 * i;
            STLB.buttonMode = true;
            STLB.useHandCursor = true;
            STLB.addEventListener(MouseEvent.CLICK, gotoSlidingTiles);
           
        }
    }
}

createButtons();

function gotoSlidingTiles(evt:*){
    stage.removeChildAt(1);
    gotoAndStop(4);
}


Would be a great help to me to tell me how to get STLB.levelNum to carry over to the next frame.

__________________
www.ExperimentalFlash.com - Crappy games, crappy toons, and other crappy stuff. Take a few minutes out of your crappy day to go there .
SumYungGai is offline   Reply With Quote
Old 11-29-2009, 12:01 AM   #3
snickelfritz
Registered User
ActionScript Code:
var indexNumber:int = 0;

inside the for loop...
ActionScript Code:
STLB.id = indexNumber;
indexNumber++;

in the click event handler...
ActionScript Code:
levelNum = e.currentTarget.id;

__________________
I used to be a paranoid-psychotic-schizophrenic, but don't worry, he's dead now.
snickelfritz is offline   Reply With Quote
Old 11-29-2009, 01:12 AM   #4
SumYungGai
Horrible Actionscripter
 
SumYungGai's Avatar
Location The middle of frickin nowhere

Posts 75
Where exactly do I put the e.currentTarget.id?

Never mind. I got it.

Sweet potato nuggets. It works.

__________________
www.ExperimentalFlash.com - Crappy games, crappy toons, and other crappy stuff. Take a few minutes out of your crappy day to go there .

Last edited by SumYungGai; 11-29-2009 at 01:17 AM..
SumYungGai is offline   Reply With Quote
Reply


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:43 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