-
old frame based habits dying hard - any tips
I'm about to begin building a site and although every time this comes around I think i should learn how to do 'that' with actionscript the work is there and the time isn't. I invariably use frames and make things work but feel I'm only lying to myself. damn!
anyhow - i want to have several, maybe 20 MCs on the stage (colored speech bubbles). Each MC will expand when clicked to reveal content. Now I can do this in my ye olde fashioned way. But want a simple code - or relevant tutorial, I'm not afraid of graft honestly - that will position all the MCs on the stage. When each is rolled over (or some clicked) I want it to expand and reveal it's content while all the other MCs shrink and move around the expanded MC??. Then when closed all MCs move back to their size and space.
Alternatively if you click the other smaller MCs when they are small they will expand and so on... ? I think I'm confusing myself.
If anyone can point me to an idiot proof tutorial or give some pointers i'll buy them a pint in the Dog n Duck in ye olde town square
ta
-
Big Baby
ok, so you need to place instances of an mc on screen
then, each clip needs to know if and when another movieclip has been clicked on and behave accordingly.
so, first of all placing your clips on stage - use a for loop
Code:
for ( var i : Number = 0; i < NUMBER_OF_CLIPS; i++ )
{
var clip : MovieClip = _root.attachMovie ( "LinkageName", "LinkageName" + i, _root.getNextHighestDepth());
}
you can work out how to get them to the right places on the stage can't you? if not look in the help files for attachMovie and look at how you can assign variables to the clips that you attach.
now, in order for the clips to know when another is clicked you need to have a reference to all these clips and listens to receive a notification that one of them has been clicked.
your reference most likely would be an array so
var clipArray : Array = new Array();
in your for loop add each new 'clip' instance to the array with
Code:
clipArray.push(clip);
now, wherever you're handling the onRelease for the movieclips that are going to be clicked you need to call a function that looks through the array and if the current index of the array is the object making the call it plays it's speech bubble thing, and, if it isn't then it tells the clip to go do something like circle around the one that has been clicked....
... see how you get on writing that function - i'm not going to give it to you but if you get stuck i'm happy to make suggestions.
That's how i would do it if i were knocking it out quickly - there are other ways to do it depending on how complex your application is eventually going to be.
-
Hi
Hi Fabriq
thanks for the quick response... is that pic of Jimmy Savile?? nice.
So.. the 'for loop' does this code go on the main timeline ?
then are you saying i don't physically place the MCs on the stage but use linkage references ?
I have an MC prepped and ready to test but just want to make sure i'm doing this right ?
thanks again
J
-
Big Baby
yes, put it on the first frame of the main timeline and 'attachMovie' will place all your mc's onstage for you - but it will place them all at the origin because you've given them no information about where you want them to go.
however, you can pass an object into attachMovie to set attributes of the movieclips once they're placed onstage - like this.
Code:
timeline.attachMovie ( "name", "newName", depth, { _x:100, _y:100} );
will place the movieclip onstage at co-ords (100, 100) - just make sure your movieclip in the library has the 'export for actionscript' tickbox ticked and it'll be able to reference the clip from the library rather than you having to drag it onto the stage.
-
hi Fabriq
just wanted to say thanks for trying to help - didn't get there in the end but will need to start looking at it again soon
cheers anyway
J
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|