all groups > flash actionscript > march 2004 >
You're in the

flash actionscript

group:

dynamic #include - external action script?



dynamic #include - external action script? herfmarc
3/9/2004 11:23:01 PM
flash actionscript: .... i need to dynamically call action script which is held in an external (.as
or whatever action-script-recognising formatted) file.
#include does only work while testing - i wonder if there is any dynamic
solution?
(... i does not help to evaluate chunks/parts of action script or variables
from external text files - it needs to be the complete action script for a
button
which will be used in combination with other action scripts held within the
main .fla/.swf file)

any ideas?

marc.herfurth@d-boes.de

Re: dynamic #include - external action script? CesareRocchi
3/10/2004 11:55:45 AM
There was a similar post few weeks ago.
There is no 'dynamic' #include. It is a directive meant to be used at design
time.
Once you have a swf you can't load/unload/modify the actionscipt it includes.

HTH,

-c.
Re: dynamic #include - external action script? Jack.
3/10/2004 12:03:52 PM
[quoted text, click to view]
afaik...not possible

[quoted text, click to view]
this is the only method you can use,

tgt = this;

lv = new LoadVars();
lv.onLoad = function(){
trace(lv.actions);
arr1 = lv.actions.split(":");
for(var ii=0;ii!=arr1.length;ii++)
arr1[ii] = arr1[ii].split("|");

tgt[arr1[0][0]].onPress = function(){
gotoAndStop(arr1[0][1]);
};

tgt[arr1[1][0]](arr1[1][1]);

};

lv.load("code_from_text.txt");

function testFunction(param){ trace("test "+param); };

stop();

// text file - actions=btn1|frame_3:testFunction|ok&

doubt this helps, but it's my 2c's worth,

Re: dynamic #include - external action script? Laiverd.COM
3/10/2004 12:37:17 PM
Don't think there's a solution to that; any actionscript must be compiled
before display, so one cannot run an swf and compile at runtime. Obviously
you could keep all kind of variables to control function execution outside
of the flashmovie, but not functions themselves.

John

--
----------------------------------------------------------------------------
-----------
RESOURCES
http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash
----------------------------------------------------------------------------
-----------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------

Re: dynamic #include - external action script? herfmarc
3/10/2004 1:26:22 PM
thanks for the replies -
jack's work-around is realy helpful, thanks for that

my problem:
evaluated text will not work for chunks of A-script like

...
_root.VARIABLENAME_NUMBER1 = VALUE_OR_VARIABLEX
_root.VARIABLENAME_NUMBER2 = VALUE_OR_VARIABLEY
...

-> i need to create and define _root.VARIABLENAME_NUMBER1 etc.
-> -> trying any combination of _root.eval("VARIABLENAME" + "_NUMBER1") =
VALUE_OR_VARIABLEX
failed so far (... since _root.VARIABLENAME_NUMBER1 is on the left hand side,
i assume)

anyhow:
i try to solve the problem with arrays at the moment which is a bit more
complicated
but working

... thank you all, again

marc.herfurth@d-boes.de



AddThis Social Bookmark Button