• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Variable in Movie Clip [ActionScript 2.0]

New Here ,
Mar 30, 2014 Mar 30, 2014

Copy link to clipboard

Copied

Hello, I am still newbie, i just want to create a very simple thing with the movie clip, i have search through internet for 2 days and found nothing.

So, this is a problem :

-> I have a movie clip name flip_box and in the Frame 1, i add action :

nowtext = "0000";

-> in the frame 15 until 23 -> I have dynamic Text -> Instance name = hitungan

--> in the Frame 15 , I add action :

hitungan.text = nowtext;

and then in the Scene 4

i add action in the Frame 1 :

var box1:MovieClip = _root.attachMovie("flip_box_lg", "fb1", this.getNextHighestDepth(),{_x:100,_y:100});

box1._width = 100;

box1._height = 40;

//_root.box1.nowtext = "50/5";

trace(_root.box1.nowtext);

trace(_root.box1[nowtext]);

trace(_root.box1['nowtext']);

trace(_root.box1.fb1.nowtext);

trace(_root.fb1.nowtext);

trace(_root.box1.flip_box_lg.fb1.nowtext);

trace(_root.flip_box_lg.fb1.nowtext);

trace(_root.flip_box_lg.nowtext);

trace(_root.MovieClip.nowtext);

trace(_root.MovieClip.box1.nowtext);

trace(_root.box1.variable.nowtext);

And this is the photo of the flip_box properties

all the trace is undefined,

i just want to change the Dynamic Text (hitungan) via actionscript

all I wanna to do is Change Dynamic Text inside the Movie Clip that i attach to the stage.

Thanks Before

FlashMovieClipProblemScreenshot.jpg


TOPICS
ActionScript

Views

1.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 31, 2014 Mar 31, 2014

it's not necessarily a problem.  it's just a matter of understanding how flash works.

as already mentioned, when you create a new instance of flip_box the code in its first frame does NOT instantly execute.  it executes after the movieclip is created.

you could use a delay to assign nowtext after it's assigned on the movieclip's timeline.  eg,

var box1:MovieClip = _root.attachMovie("flip_box_lg", "fb1", this.getNextHighestDepth(),{_x:100,_y:100});

this.onEnterFrame=assignF;

function assignF():Void{

de

...

Votes

Translate

Translate
Community Expert ,
Mar 30, 2014 Mar 30, 2014

Copy link to clipboard

Copied

what's trace(box1) show?

if undefined, you must publish for fp 7 or better to use getNextHighestDepth and you should be using _root.getNextHighestDepth() because you're attaching that box to _root.

else you have a typo somewhere.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 30, 2014 Mar 30, 2014

Copy link to clipboard

Copied

_level0.fb1 -> trace(box1)

[if undefined, you must publish for fp 7 or better to use getNextHighestDepth and you should be using _root.getNextHighestDepth() because you're attaching that box to _root.

else you have a typo somewhere.]

What does it mean ? And how ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 31, 2014 Mar 31, 2014

Copy link to clipboard

Copied

it means there's no nowtext on frame 1 of box1 (or nowtext is a component like a textarea).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 31, 2014 Mar 31, 2014

Copy link to clipboard

Copied

But nowtext is the variable that i add as actionscript in the movie clip at frame 1.

Should i upload the .fla ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 31, 2014 Mar 31, 2014

Copy link to clipboard

Copied

then it won't be available until frame 1 of that movieclip plays (which is after box1 is created).  ie,

nowtext = "0000"

executes after your attachMovie statement (and after those trace functions).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 31, 2014 Mar 31, 2014

Copy link to clipboard

Copied

Could you please give me a code that probably could fix the problem ?

Is my code (writing the as2 about movie clip variable) wrong or there is another problem ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 31, 2014 Mar 31, 2014

Copy link to clipboard

Copied

it's not necessarily a problem.  it's just a matter of understanding how flash works.

as already mentioned, when you create a new instance of flip_box the code in its first frame does NOT instantly execute.  it executes after the movieclip is created.

you could use a delay to assign nowtext after it's assigned on the movieclip's timeline.  eg,

var box1:MovieClip = _root.attachMovie("flip_box_lg", "fb1", this.getNextHighestDepth(),{_x:100,_y:100});

this.onEnterFrame=assignF;

function assignF():Void{

delete this.onEnterFrame;

nowtext="50/5";

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 01, 2014 Apr 01, 2014

Copy link to clipboard

Copied

Thank you very much.

At first i got a problem, i have changed the variable with your function, but not the textbox (i dont know why), then i just delete the "delete this.onEnterFrame" and then i replace the nowtext="50/5"; with box1.hitungan = "myword", i found this weird that my words are missing some letter, after searching, i found that i must set it at Embed, now it work perfectly, thank you very much. :')

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 01, 2014 Apr 01, 2014

Copy link to clipboard

Copied

LATEST

you're welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines