Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting too old for dynamic objects?

Status
Not open for further replies.

Sleidia

Technical User
May 4, 2001
1,284
FR
Good Morning,

I was using Flash a long...long time ago but for some reason
I had to concentrate on Javascript, PHP and Mysql boring stuffs
(useful though).

Time has passed and Flash has evolved so much with the action
scripting that I am totally lost and that I am in need of some hint
about how to add symbols dynamically in a Flash movie.

For example, let's say we get data from a text file. 3 lines of text would give 3 objects, 5 lines 5 objects and so on.

Getting Keywords would be a good enough help. Google will do the other part.

Thank you very much to the one(s) who will gove response.
Have a good day.
 
I'm not really sure what u r trying to accomplish here. if i understand you right, you can duplicate movie clips for each of your objects. give some more details if u dont mind then we can really know how to help.

bigggie
 
Hello Bigggie!

What I am trying to do is to make the flash movie retrieving the content from a flat text file or an array or a mysql database. This data would be parsed with actionscript and the right number of items (symbols) would be displayed in the flash movie.

For example: if I have 3 words as the data such as: "Hello my friend", we would have
3 buttons displayed with appropriate caption:
Button1 -> Hello
Button2 -> my
Button3 -> friend.

I've seen plenty of tutorials but couldn't find the one I need. Also, I have to admit that Flash is far from being the most intuitive tool!

Thanks a lot for getting back to me.
 
if you don't mind, could u tell me how do you intend to do this server-wise? what server-side script do u want to use. and how many variables do u intend to upload into flash. and would a single variable contain all the objects?

what u could do initially in flash is make a movie clip with an invisible button and a dynamic textbox under the button. this box would contain the word and the invisible button would contain the onClick script.

After you do LoadVariables you can duplicate this movie Clip as many times as needed with the text in the dynamic TextBox. I'll give u a sample after I get some sleep. if u don't mind. I'll post a fla here as soon as I finished it.
 
Hello again !

Thanks for your fast reply.

Actually, I am well familiarized with the use of PHP/mySql
in my pages. Also, I've found several tutorials about mySql integration with Flash and I think that won't be the most difficult part for me.

With PHP, you can loop through your mySql table and retrieve the relevant data with a Sql query. Then, you can outpout data into a javascript array inside the processed page or into a flat text file. I can do that easily.

What I don't understand starts when making the flash file.
What I have to do is make the movie loop through the array/text file and output
the right numbers of dynamic textbox (like you said) with
the right caption. Of course, the length of the array/text file isn't fixed.
I was told it's not very complex, but although I know a lot about Javascript I can't figure how to write proper actionscript and how to attach written actionscript to symbols.

Thanks from the bottom of my heart for offering to send a fla file.

See you.


 

Hello!

It was difficult, but yesterday, I've found the way to
duplicate movieclips according to the size of an array
in Flash.

here is the code:

var got = new array("aaa", "bbb", "ccc", "ddd", "eee", "fff");
ifFrameLoaded (1) {
for (i=1; i<got.length; i++) {
duplicateMovieClip (&quot;folder&quot;, &quot;folder&quot;+i, i);
_root.folder._y = (i*50);
_root.folder._x = (i*50);
folder._alpha = folder._alpha-(i*5);
}
_root.folder1._visible = false;
}

Now I am facing 2 problems and I couldn't solve them even after
spending the whole day on it. Internet search didn't help either...

What I am trying to do is:

1)-> insert a delay in milliseconds between the duplication of each
folder object.
I guess it is done with getMilliseconds() or getTimer(), but that't all I know.
2)-> Each movieclip called folder is made of 2 layers. One for
the folder itself and one for a dynamic text object I set-up accordingly
to a tutorial I found. The dynamic text variable is called &quot;dyna_text&quot;.
In the loop, I've inserted dyna_text = got in order to have folders named
aaa, bbb, ccc, ddd, etc... but it doesn't work.
Would you know why? (text color is black and font is arial).

Thanks a lot for coming up with some idea!
Have a good day.
 
Try this :

Code:
var got = new array(&quot;aaa&quot;, &quot;bbb&quot;, &quot;ccc&quot;, &quot;ddd&quot;, &quot;eee&quot;, &quot;fff&quot;);
ifFrameLoaded (1) {
    for (i=0; i<got.length; i++) {
        var x = i+1
        duplicateMovieClip (_root.folder0, &quot;folder&quot;+i, i);
        _root[&quot;folder&quot;+x]._y = (i*50);
        _root[&quot;folder&quot;+x]._x = (i*50);
        _root[&quot;folder&quot;+x]._alpha = _root[&quot;folder&quot;+(i-1)]_alpha-(i*5);
        _root[&quot;folder&quot;+x].dyna_text = got[i]
    }
    _root.folder0._visible = false;
}
Regards

Big Bad Dave

davidbyng@hotmail.com
 
Sorry I mean :

var got = new array(&quot;aaa&quot;, &quot;bbb&quot;, &quot;ccc&quot;, &quot;ddd&quot;, &quot;eee&quot;, &quot;fff&quot;);
ifFrameLoaded (1) {
for (i=1; i<got.length+1; i++) {
duplicateMovieClip (_root.folder0, &quot;folder&quot;+i, i);
_root[&quot;folder&quot;+i]._y = (i*50);
_root[&quot;folder&quot;+i]._x = (i*50);
_root[&quot;folder&quot;+i]._alpha = _root[&quot;folder&quot;+(i-1)]_alpha-(i*5);
_root[&quot;folder&quot;+i].dyna_text = got[i-1]
}
_root.folder0._visible = false;
} Regards

Big Bad Dave

davidbyng@hotmail.com
 

Hey BBD, thanks a lot!
Thanks to you, now I understand how to call duplicated
movieclips and their inner objects properly.

I am going to try this right now.

Have a beautiful day!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top