View Full Version : loading in external .as files
.:®:.
December 16th, 2003, 04:08 AM
Hi,
Okay, i know how to load in external .as files so I can update easily. but why do you still have to re-publish the swf in order for the new .as file 2 take effect.
is there any way that you can make a .as file be read in & so that it updates the .swf file, much like the way loading an xml or .txt file does?.
any comments are appreciated......
thanks
norie
December 16th, 2003, 05:09 AM
The purpose for AS files is to reference AS code used in multiple swfs--saves time and headaces. The swf must still be COMPILED in flash for it to be viewed on the web. I'm pretty sure that'd be way too much server processor speed to compile AS on the fly. So if you are just loading variables and data i would suggest using text files.
.:®:.
December 16th, 2003, 08:17 PM
Thanks Norie,
I actually meant that after i compile a movie, i use an external .as file to load in the data. i don't want this file to write on the fly, but when I update the variables, within the .as script, they weren't recognised when I reloaded the swf. maybe this could be a cache thing?.
But point taken about the computations & speed. thanks!
senocular
December 16th, 2003, 09:54 PM
I think the point might have been missed. External .as files are NOT accessed when the movie is played. They are accessed and included when the movie is created. So any change you might make to an .as file that you used within your movie would require you to republish your movie so those changes can be added in to the .swf file. Once that swf file is complete, the .as file is no longer needed for it to run properly (as the code was'included' when the swf was created).
So with that, there technically isnt a way to reference an external .as file AFTER the movie has been made and simply make changes in that .as file to have that then reflected in the swf without republishing. You would instead want to load in a text file with load variables or get information through xml with the XML object and an external xml file. These methods are still pretty much primarily for variable values to help direct your movie. They cannot provide commands to control it where Flash would then just be able to rea a bunch of code and make it work. Id doesnt work like that.
However, there have been attempts made at actually making a parser for actionsctipt with actionscript so that could be accomplished. The best Ive seen (which is quite impressive - as it should be, a lot went into it) can be found here:
http://flashcomponents.net/component.cfm?nav=2&id=118 (Flash MX)
note that this wont work with all code and that will be much more a strain on the processor to handle in comparison to code included at time of publish or creation.
norie
December 16th, 2003, 09:59 PM
http://www.kirupa.com/developer/actionscript/tricks/cache.htm
.:®:.
December 16th, 2003, 10:00 PM
Brilliant. Thanks Senocular.
I was hoping you could shed some light on the subject. I have
seen your greatness with xml, so many thanks.
I will do some hard research into it as I know it is not that simple.
thanks again!
senocular
December 16th, 2003, 10:22 PM
welcome :D
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.