Discussion:
Loading external text file...In second?
(too old to reply)
Roxie_
2009-03-11 23:29:51 UTC
Permalink
Ok so i want to use the option to load an external file in my flash site but my problem is to have it load in second, after all my animation as stoped. Can this be done, if so, how?

Thanks!
NedWebs
2009-03-11 23:53:26 UTC
Permalink
Whatever you can use that would indicate the animations have stopped, such as the last frame of whatever is animating would be the place to trigger some function to load the external file.
Roxie_
2009-03-12 00:08:06 UTC
Permalink
ok well in this case its tricky since i applied the animation to a redbox that
i will be using in more than one page but i dont want it to load the same text
content where ever each red box will load....
NedWebs
2009-03-12 01:08:22 UTC
Permalink
You can utilize a boolean variable that you set when the load is initiated so that the changed status of it inhibits any further call to the function.
Roxie_
2009-03-12 13:37:45 UTC
Permalink
ok. I understand what you mean but i have no clue how to do that but in the
mean time, ive actually attached the script to the box like you suggested. I
will be using the same redbox often but it wont be in the same page so it
shouldnt cause problems... hopefully!
Roxie_
2009-03-26 01:07:52 UTC
Permalink
ok i need help with this again! I had to change how i did my site completely
cause i wasnt doing it the right way....
Im following this tutorial
(http://www.flash-game-design.com/flash-tutorials/make-a-flash-website-4.html)
to do my website and so far everything is good except when i get to my content.
I have 6 different colors of boxes used for my content. Same intro animation
is applied to all six. I have 15 pages of content to create. So what i need to
do first is load my redbox and then load my home external text for each page.
Right now i have it so that my external text is loaded at the end of the
animation mc but im going to be using the redbox for other pages so i cant have
the home text load everytime with the redbox... I hope i explained this
properly cause i really need help. i could even show you my file... PLEASE HELP.
NedWebs
2009-03-26 01:48:39 UTC
Permalink
Like I said originally, if you set some variable in the main timeline, let's
call it loadData and initialize it as true, you can use that to control whether
or not the loading occurs...

if (loadData){
// load the file
loadData = false;
}

Once the loading is started you can set loadData to false as shown above and
that conditional won't allow the loading to occur again.

As an alternative...

Do you have to use the same red box for all of the pages, or could you switch
it out for a clone that doesn't have the file loading?
Roxie_
2009-03-26 14:39:16 UTC
Permalink
Ok so the following pages are using the redbox: home, news and rules (other
pages are using other color boxes). I could always duplicate everything 3 times
and have each box load their external text. I could do it that way but i figure
their must be a way to do it without having to duplicate the same redbox 3
times so that way my file wouldnt be too big.
All my pages, except my photos and cakes page, will be loading text
externally.
I really dont know much of actionscript, i took a course but havent practice
it so might need a little patience here...

so if i use...
if (loadData){
// load the file
loadData = false;
}

Im not sure what loadData would represent....
NedWebs
2009-03-26 15:35:07 UTC
Permalink
I described what it woulkd represent earlier. If you only want to load
something once, then you use that loadData variable to only allow it to happen
once by surrounding the code that loads the file with the codnitional I showed.
It's as simple as I can make it.

As far as the alternate option goes:

If the red box is a Flash graphic, then going the other way and creating
multiple copies of it isn't going to bloat your Flash file much at all. It's
when you start using imported images and components that you really add some
weight to a file. Since you don't seem to have a good basic handle of
programming logic (no offense), it might be the better solution for you to be
able to manage.
Roxie_
2009-03-26 23:40:53 UTC
Permalink
None taken! lol Ok i will try to work it out with the script and if i cant
figure it out, ill go with the duplicating the box option. The box is actually
an image i created in Photoshop and imported as a png. I could surely reproduce
it in Flash if i needed to. Would that make things lighter on the file?!
Thanks for all your help as usual!
NedWebs
2009-03-27 00:00:23 UTC
Permalink
Reproducing it in Flash could reduce it is quite a bit, though it's often hard
to say with png files. Sometimes they weigh more than they should.

Think of the script approach as a bouncer waiting at the door inside your
loading function that's only gonna let that load fella in once.

Loading...