Go Back   kirupaForum > Flash > ActionScript 1.0/2.0

Reply
 
Thread Tools Display Modes
Old 10-20-2009, 09:05 AM   #1
Signy
Flash Novice
Fla Script [cs4]Finding movieclips on the stage[as2]

Hello all,

Right I've started building a game similar to that of balloon pop or bejewled except for super simple with no real aim other than to just waste some time.

So a little of what I've got going on so far.

Part one:



When the flash compiles it starts dynamically creating each of my dots from a possible 5 colours. Each unique id thats spawned is pushed into an array.

Part two:



It creates about 680 uniquely named movie instances of my dots, all these dots have four different states intro, idle, down and dead. They all react to the mouse depending on what i need them to do.

Part three:



You can click on any of the dots they play their death animation and then they're removed from scene. But not befor sending back their unique name, x and y and color.

Part four:

This is the code that makes it all possible.

Code:
dynamic class scripts.enginScript extends MovieClip{
    
    var MAX_DOTS:Number         = 680;
    
    var dotIdent:Number         = 1;
    var dotConstruct:Object;
    var dotMov:Object;
    var dotsSpawned:Number         = 0;
    var dotMovies:Array         = ["green","orange","pink","purple","yellow"];
    var xPosArray:Array         = [];
    var yPosArray:Array         = [];
    var spawnedArray            = [];
    var arrayRand:Number;
    var positionIncrease:Number = 28.7;
    var xPos                     = 10;
    var xStartOfRow             = 10;
    var xEndOfRow                 = 947; 
    var yPos                     = 10;
    var setUpComplete:Boolean    = false;
    
    function enginScript(){
        
        _global.enginScript = this;
        
        dotMov = new Object;
    }
    function onEnterFrame(){
        
        if(setUpComplete == true){
            dotUpdate();
        }else{
            dotSetup();
        }
    }
    function dotSetup(){
        layerPlace             = this.getNextHighestDepth();
        dotObject            = createDot();
        if(dotsSpawned < MAX_DOTS){
            dotMov.movie = this.attachMovie(dotConstruct.movie,dotConstruct.ident,layerPlace,dotObject);
            dotMov.movie._x = xPos;
            dotMov.movie._y = yPos;
            spawnedArray.push(dotConstruct.ident);
            if(xPos >= xEndOfRow){
                xPos = xStartOfRow;
                yPos += positionIncrease;
            }else{
                xPos += positionIncrease;
            }
            dotsSpawned++;
            dotIdent++;
        }else if(dotsSpawned == MAX_DOTS){
            setUpComplete = true;
            return;
        }
    }
    function currentDot(dotIdent){
        //trace(dotIdent._x);
        //trace(dotIdent._y);
        //trace(dotIdent.dotClr);
        //trace(dotIdent.ident);
        //xPosArray.push(dotIdent._x);
        //yPosArray.push(dotIdent._y);
        //dotIdent.removeMovieClip();
        
    }
    function selectedDot(dotIdent){
        activeDotSelection = dotIdent;
    }
    function killDot(){
        activeDotSelection.removeMovieClip();
    }
    function dotUpdate(){
        //layerPlace         = this.getNextHighestDepth();
        //dotObject            = createDot();
        //arrayRand            = Number(random(xPosArray.length));
    }
    function createDot(){
        dotConstruct                             = new Object();
        dotConstruct.movie                         = dotMovies[random(dotMovies.length)];
        dotConstruct.ident                        = dotIdent;
        dotConstruct.dotClr                        = dotConstruct.movie;
        
        return dotConstruct;
    }
}
Now i was all well and happy coding away until i've reach the point no where i don't just want to click on dot and it vanish i want to click one dot and any dot of the same color touching it or linked to it through a color chain vanish aswell. Then after a prolonged period of time have new dots gently fade in.

This is where i hit a brick wall everytime i go to approach a sollution i start thinking ahead and realise befor i even get start that it won't work. I'm really looking for and suggestions or tips that can set me on the right track.

I guess I'll start with my first problem how can i find using the information the dot im hovering over sends back find out what movie clips are around it?

Thank in advance and for your time

Take it easy ya'll

Sigs
Signy is offline   Reply With Quote

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

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