TwelvestoneFlash

help hacking an array into the place of random number in a yugop stickman file?


Sign in

  • Waiting for Godot ( 730 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 5.1 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.9 k posts )
    general front end design an...
  • Back End ( 9.7 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
derrickito
 
2008-08-14

im hacking apart and old yugop style sideways navigation file.. right now it takes the total number of buttons and distributes those numbers into a text field, one on each button. I'd like to mod this to have an array of text distributed out on the buttons instead of numbers.. but my AS skills aren't up to par. some help? working file is herehttp://point83.com/junk/navbuild.fla

code setting up my script on the main timeline:

number_menu_items = 7; menu_item_width = 300; menu_width = number_menu_items * menu_item_width; menu_ypos = 100; screen_center = 275; speed = 1;

code on the movie clips setting up each clip with sequential numbers:

onClipEvent (load) { for (counter=1; counter<=_root.number_menu_items; counter++) { //create ORIGINAL set of menu items menu_item.duplicateMovieClip("menu_item"+counter, counter); this["menu_item"+counter]._x = (counter-1) * _root.menu_item_width; this["menu_item"+counter]._y = _root.menu_ypos; this["menu_item"+counter].number = counter; //create DUPLICATE set of menu items dup_number = counter + _root.number_menu_items; menu_item.duplicateMovieClip("menu_item"+dup_number, dup_number); this["menu_item"+dup_number]._x = ((counter-1) * _root.menu_item_width) + (_root.menu_item_width * _root.number_menu_items); this["menu_item"+dup_number]._y = _root.menu_ypos; this["menu_item"+dup_number].number = counter; } menu_item._visible = 0; } onClipEvent (enterFrame) { //calculate new position of menu menu_x = this._x + ((_root.screen_center - _root._xmouse) / _root.speed); //check to make sure menu is within screen boundaries if (menu_x < 0-_root.menu_width) { menu_x = menu_x + _root.menu_width; } else if (this._x > 0) { menu_x = menu_x - _root.menu_width; } //reposition menu this._x = menu_x; }

i would like to mod this so that instead of number appearing on the buttons, the contents of this array would be displayed: Item 1 here, This is Item 2, Item number 3, 4th Item, Fifth Item YAY, 6th one here, And number 7

some help on how to mod the above? my AS skills are below par these days in getting the syntax right. and thanks stickman for putting up his old files, this is one of his

thanks

Storm
 
2008-08-14

First, go into the MC and remove the display text box variable named "number" and give the text box an instance name (I used "titleTxt"). You also have change the "embed" on your text box to go from 'Numerals" to include 'Upper' and 'Lower Case' and whatever else you need.

// added to the main timeline var array:Array = new Array("one", "two", etc. etc.);

//onClipEvent (load) EDIT this["menu_item"+counter].number = counter; TO this["menu_item"+counter].titleTxt.text = _root.array[counter];

Change your publish settings to Flash Player 7 at minimum (AS1 or 2 doesn't matter). [edit]It should work in Flash Player 6.

Does that work?

If you want to stay in Flash 5, you could change the array declaration to: array=("zero", "one", etc) - I think????

derrickito
 
2008-08-15

ill give that a try, right after i go down a bottle of whiskey. jlkfd;jlkfds;lkja

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

help hacking an array into the place of random number in a yugop stickman file?