PDA

Click to See Complete Forum and Search --> : script generated button instances



Killipso
03-26-2002, 08:24 AM
at this URL

http://www.webtechniques.com/archives/2001/08/hall/

there are instructions to build a stretchy menu. Kindly the author replyed to an enquirey of mine regarding adding actual navigation as follows:

"Here's the basic info you need:

Select the blank MC on the main timeline and underneath this chunk of code:

for (var i=0; i<numItems; ++i){
this.attachMovie("item", "item"+i, i);
this["item"+i]._x = i * 60;
this["item"+i].text = "Item "+i;
this["item"+i].speed = 0;
}

add lines like this to change the names and give URLs to each item:

this.item0.text = "Fig Leaf"
this.item0.url = "http://www.figleaf.com";


Then, find the item background MC in your library, select the button there
on the stage and add the following code to it:

on(release){
getURL(this._parent.url, "_blank");
}

Thats it!"

Now, I've followed this and messed with it but just don't get anywhere! The URL bit works but the text (originally a number) on the button just disappears. I was after buttons with specific labels and loadMovie actions.

Can anyone explain!?

ironmallet
03-28-2002, 03:14 PM
the obvious:

that the text is on the same layer as the button graphic, and is displayed behind the graphic on one ore more frames of the button. Put it on it's own layer, right on top.

the odd:

The text is being displayed at an angle. Dynamic text boxes don't work on angles. System fonts don't have instructions for wht the text looks like at an angle.

the typo?

is the way you typed in th attachMovie bit equivalent to the way he used it here?

onClipEvent(load){
numItems = 8;
friction = .6;
speedratio = .3;
boost = 20;
invboost = -boost/(numItems-1);
base = 60;

for (var i=0; i<numItems; ++i){
this.attachMovie("item", "item"+i, i);
this["item"+i]._x = i * 60;
this["item"+i].text = "Item "+i;
this["item"+i].speed = 0;
}
}

Killipso
03-29-2002, 01:20 PM
Thanks,

I checked out your suggestions alas with no luck......but then again using my new Flash MX looking at the properties panel I spotted something interesting - the text field was set to include numbers only! Hey presto - one click to include all characters and everything is fine!

So perhaps there should have been an "EVEN MORE OBVIOUS!"

That's IT

ironmallet
04-01-2002, 05:54 PM
i'm working on a menu based on this premise, maybe to make a calendar ala bit-101 with experimental swfs organized that way.

here's the jist

thanks to bit-101 as usual for alot.

http://www.ironmallet.com/flashkit/maskButtons.htm


the cool part is how small these files can get.

Killipso
04-02-2002, 05:01 PM
Exactly! That was the general idea - "small but effective!"