Hello ya’ll!
I need some help because i’m totally new to AS3 and I’m not liking it so far lol
I’m messing around and trying to build a custom YouTube player, but what I want is to have the YouTube ID inside a .xml file and have AS3 to pull in that ID. Easy right?.
I have that working and I see it with the trace statement, but the issue i’m having is if you take a look at my code on line 30 you will see what I’m trying to attempt lol.
So Instead of using: player.loadVideoById("uZSobH1wiiM"); // Loads the youtube id
I want to have the “uZSobH1wiiM” be brought in via xml and you can see that I’m almost there. I just need a few more steps. Right?
I’m getting an error. The error is: 120: Access of undefined property youtubeID.
Here is my .xml structure:<site> <video_list><video>uZSobH1wiiM</video></video_list> </site>
Here is my code for the YouTube player http://pastie.org/4174267
So if someone could please explain to me what I’m doing wrong and what I should be doing right.
Thanks
Tim
- Has been a member for 4-5 years
- Author was Featured
- Contributed a Tutorial to a Tuts+ Site
- Netherlands
- Community Moderator
- Microlancer Beta Tester
- Sold between 10 000 and 50 000 dollars
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Exclusive Author
That’s weird! When I recreate the files (and cut out everything but the XML -loading) it worksed just fine! Can you perhaps add a trace(xmlData) before the youtubeID assignment, to figure out if the XML file is read correctly, or what xmlData contains at least? Perhaps even trace e.target.data before assigning it to xmlData.
- Author was Featured
- Sold between 50 000 and 100 000 dollars
- Author had a Free File of the Month
- Bought between 1 and 9 items
- Exclusive Author
- Europe
- Has been a member for 3-4 years
- Referred between 10 and 49 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
This needs to be defined on global level to be accessible outside the function:
var youtubeID:String
- Has been a member for 4-5 years
- Author was Featured
- Contributed a Tutorial to a Tuts+ Site
- Netherlands
- Community Moderator
- Microlancer Beta Tester
- Sold between 10 000 and 50 000 dollars
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Exclusive Author
Tean said
This needs to be defined on global level to be accessible outside the function:
He’s not accessing it outside the function, though, right?
EDIT : Nevermind, you’re right. I thought the trace was throwing the error, but it is in fact the player.loadVideoById(youtubeID); line. Tean has the solution!
Thanks allot guys.
@Tean I learned alittle last-night and I got to that point, but now i’m getting a trace of “null”
Whats the deal?
Thanks for your time guys. I appreciate it allot.
Nevermind doh!
Got it! Thanks again!
