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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xml flash

Status
Not open for further replies.

mmmbob

Programmer
Jul 23, 2003
29
US
This is prolly not possible in flash, but I thought i'd ask just for shits and giggles.
Would it be possible to write a callback in flash, where the funtion is defined in xml and is assigned to a variable when read into flash, while that variable acts as a place holder in flash.

So say i have a method <func><![CDATA[foobar() {....
}]]></func>
coming in from xml.
can I do something to the effect of: bar = <node that equals the fucntion foobar() coming in from xml>
and use bar everywhere in the actionscript code......
Thanks.
 
not sure if this is what you are asking but no reason why you cant pass an action (loadmovie say) as part of an xml node

with a piece of xml like this

<item name=&quot;something or other&quot; action=&quot;loadMovie&quot; movie=&quot;some.swf&quot; />
</item>

this is ok in flash

if(item.data.action == &quot;loadMovie&quot;) {
holder.loadMovie(item.data.movie);
mytext.text = item.data.name;
}




 
nope...what i was asking was more like.
<page>
<func> foobar(){ trace(&quot;foobar&quot;); }
</func>
</page>

then in flash
bar = page.childNode.nodeValue;

and then using bar all over the place to print foobar.
 
only other reliable method i can think of is to use asfunction in the xml. then by placing that node in a textfield it becomes clickable and can then call an actionscript function.

that would allow you to name a function and pass parameters to it through xml

 
thanks, but you explain that a bit more...i don't think i completely follow you.
 
it would work like this

xml side

<Func>asfunction:testing,1</Func>


flash

function testing(x){
if(x==1)
trace(&quot;Function Called&quot;)
}


any clearer?
 
i got this example but i wnat the behaviour to be reversed. where the function is called in the flash side, but defined in the xml side.......does that make sense?
Thanks for the help so far.
 
makes sense ok....cant think of any method to get it done...i suspect asfunction is as close as you will get
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top