ThemeForest

Really quick dumb AS2 question

408 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 100 and 499 items
  • United States
  • Referred between 10 and 49 users
arctic_ark says

Hi, this is the most beginner thing I can think of, but its somehow a mystery to me still…

I have 5 buttons, everytime time a button is clicked, I need a dynamic text field to say different words for different buttons…

My buttons and dynamic text fields are on different timeslines, due to animation….

Does anyone know a way to do this?

3 years ago
4211 posts
  • Has been a member for 3-4 years
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Community Superstar
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Bought between 100 and 499 items
  • United States
  • Referred between 50 and 99 users
CodingJack says
You can climb the display list by using _parent. So maybe your movieclip is three levels up, you’d say

_parent._parent._parent.myMovieClip.theText.text = "button text";
3 years ago
408 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 100 and 499 items
  • United States
  • Referred between 10 and 49 users
arctic_ark says

yea, this would work, but…

after you click a button that changes the dynamic text, theres an outro animation first, then the text file shows up…

when i try to set the variable anyway from an onPress event, the variable is never set.

So I try to set the variable from a button click, after the button click the object animates out, and then the text animates in, only…variable isnt being set.

3 years ago
4243 posts
  • Has been a member for 3-4 years
  • Contributed a Blog Post
  • Attended a Community Meetup
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
Aw_Shucks says

Just a kinda weird suggestion, but here goes. You could use an onEnterFrame that checks for a variable to see if the text field has loaded. Once it has then delete the onEnterFrame and fill in the dynamic text field dynamically.

3 years ago
6469 posts
  • Has been a member for 4-5 years
  • Won a Competition
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Grew a moustache for the Envato Movember competition
  • Community Moderator
  • Beta Tester
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 50 and 99 items
  • United Kingdom
  • Referred between 10 and 49 users
MSFX says
Just a kinda weird suggestion, but here goes. You could use an onEnterFrame that checks for a variable to see if the text field has loaded. Once it has then delete the onEnterFrame and fill in the dynamic text field dynamically.

eeeeeeeeeeeeeewwwwwwwwwwwwwwwww :P

maybe the right idea but not listen for a CHANGE event :) far less heavy on resources… EF should be for animation only and stopped when its not animating! :)

3 years ago
MSFX is a moderator
6469 posts
  • Has been a member for 4-5 years
  • Won a Competition
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Grew a moustache for the Envato Movember competition
  • Community Moderator
  • Beta Tester
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 50 and 99 items
  • United Kingdom
  • Referred between 10 and 49 users
MSFX says
when i try to set the variable anyway from an onPress event, the variable is never set.

then you have a scope issue, you must be accessing it at the wrong level…?

seriously using Events in AS3 would have this done before you started typing, dunno how I managed in AS2 :(

can you declare a var global and get/set that..?

3 years ago
MSFX is a moderator
2996 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a File in an Envato Bundle
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 50 and 99 items
  • India
  • Referred between 200 and 499 users
VF says
yea, this would work, but… after you click a button that changes the dynamic text, theres an outro animation first, then the text file shows up… when i try to set the variable anyway from an onPress event, the variable is never set. So I try to set the variable from a button click, after the button click the object animates out, and then the text animates in, only…variable isnt being set.

Then you may want to set the text field value in its own movieclip’s timeline through a variable. Example:
myTextField.text=_parent.textVar; (make sure the target is right)

So you will set that variable value on button click:
textVar="My Text";

3 years ago
408 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 100 and 499 items
  • United States
  • Referred between 10 and 49 users
arctic_ark says

I was thinking have a movieclip that has each text on its own frame, then when the button is clicked, the mc goes to right frame, keep this movieclip invisible, until animation is gone, then declare it visible, I dono Im gona try that now ill get back to you

3 years ago
408 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 100 and 499 items
  • United States
  • Referred between 10 and 49 users
arctic_ark says

SO ME AND MY CODELESS IDEA WORKED .

I have an mc with all the text ON ITS OWN FRAMES , I have the mc invisible on the same frame as my buttons, then u click the button, the invisible mc goes to the right text, the animation plays, then the mc becomes visible. VOILA !...man I need to learn more ActionScript 3 though….Ive been riggin components on the timeline since flash 8!

But it still works!

3 years ago
by
by
by
by
by