-
How to get AS3.0 to work AS2.0
I got this twitter script from Blue_chi.
it works in Actionscript 3. How do i get this code to work in Actionscript 2?
var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load(new URLRequest("twitter.php"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void{
var myXML:XML = new XML(e.target.data);
tweet_1.text = myXML.status[0].text;
tweet_2.text = myXML.status[1].text;
tweet_3.text = myXML.status[2].text;
-
Actionscript Code:
var xml:XML=new XML(); xml.ignoreWhite=true; xml.onLoad=function(success){ if(success){ trace(xml); } } xml.load("twitter.php");
FFA
-
do you still use this line:
tweet_1.text = myXML.status[0].text;
-
Prid - Outing
Dunno, not good with AS3 - however, if you could post a small portion of your XML file?
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Actionscript Code:
var xml:XML = new XML(); xml.ignoreWhite = true; xml.onLoad = function(success) { if (success) { var nodes = this.firstChild.childNodes; trace(nodes[0].childNodes[0].firstChild); trace(nodes[1].childNodes[0].firstChild); trace(nodes[2].childNodes[0].firstChild); } }; xml.load("twitter.php");
Code:
<root>
<status>
<text>A</text>
</status>
<status>
<text>B</text>
</status>
<status>
<text>C</text>
</status>
</root>
//Output expected:
A
B
C
FFA
-
Thanks for the help. I just don't understand nodes or childnodes.
Do i label the dynamic text box as something?
-
Prid - Outing
Yes, you have to give it an instance name from the Properties Panel, and then change its text by using this code:
Code:
dynamic_txt_instance_name.text = "Text Changed";
where dynamic_txt_instance_name is the instance name you gave it, and "Text Changed" the text you want to change it to, which can also be:
Actionscript Code:
var nodes = this.firstChild.childNodes; dynamic_txt_instance_name.text = nodes[0].childNodes[0].firstChild;
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
NICE!! Thank you. I think i need to dive into some books on code..Im more on the animation side
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|