A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: script generated button instances

  1. #1
    Member
    Join Date
    Mar 2002
    Location
    Nottingham
    Posts
    35

    Post

    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!?

  2. #2
    Senior Member ironmallet's Avatar
    Join Date
    Feb 2001
    Posts
    252
    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;
    }
    }




  3. #3
    Member
    Join Date
    Mar 2002
    Location
    Nottingham
    Posts
    35
    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

  4. #4
    Senior Member ironmallet's Avatar
    Join Date
    Feb 2001
    Posts
    252
    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.

  5. #5
    Member
    Join Date
    Mar 2002
    Location
    Nottingham
    Posts
    35
    Exactly! That was the general idea - "small but effective!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center