332 posts
  • 8 Years of Membership
  • Collector Level 4
  • 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

3875 posts Community Moderator
  • Weekly Top Seller
  • Moderator
  • Tuts+ Instructor
  • Netherlands
+10 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.

1689 posts Envato Elite Author
  • Affiliate Level 2
  • Author Level 8
  • Collector Level 1
  • Top Monthly Author
+8 more
Tean
says

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

var youtubeID:String

3875 posts Community Moderator
  • Weekly Top Seller
  • Moderator
  • Tuts+ Instructor
  • Netherlands
+10 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!

332 posts
  • 8 Years of Membership
  • Collector Level 4
  • 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.

332 posts
  • 8 Years of Membership
  • Collector Level 4
  • United States
timmylogue
says

Nevermind doh!

Got it! Thanks again!

by
by
by
by
by
by