320 posts
  • Has been part of the Envato Community for over 7 years
  • Has collected 100+ items on Envato Market
  • Located in United States
timmylogue says

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

3715 posts Community Moderator
  • Helps us moderate the forums
  • Contributed a tutorial on Tuts+
  • Located in Netherlands
  • Made it to the Authors' Hall of Fame
+9 more
Joost Moderator says

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.

1677 posts Envato Elite Author
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
Tean says

This needs to be defined on global level to be accessible outside the function:

var youtubeID:String

3715 posts Community Moderator
  • Helps us moderate the forums
  • Contributed a tutorial on Tuts+
  • Located in Netherlands
  • Made it to the Authors' Hall of Fame
+9 more
Joost Moderator says

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!

320 posts
  • Has been part of the Envato Community for over 7 years
  • Has collected 100+ items on Envato Market
  • Located in United States
timmylogue says

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.

320 posts
  • Has been part of the Envato Community for over 7 years
  • Has collected 100+ items on Envato Market
  • Located in United States
timmylogue says

Nevermind doh!

Got it! Thanks again!

by
by
by
by
by
by