Welcome to Dream.In.Code
Getting Help is Easy!

Join 86,257 Programmers. There are 2,039 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

Playlist - 1st time loads Undefined

 
Closed TopicStart new topic

Playlist - 1st time loads Undefined, JavaScript communicates with Flash & Flash loads the Xml

bmcc81
post 30 Apr, 2008 - 01:21 PM
Post #1


D.I.C Head

**
Joined: 10 Jul, 2007
Posts: 70



So,

Basically the first song, when I clicked on doesn't load up. It just says undefined. But once the first text link is clicked then all the other text links work and if you go back to the initial one you clicked it works too.

Example of MusicPlayer. Amazon.com Style

This is the code that I have on each frame of my ActionScript. You can download the files Here icon_up.gif


CODE
stop();

// Setup sound object
var s:Sound = new Sound();
//s.onSoundComplete = playSong;
s.setVolume(75);

// Array of songs
var sa:Array = new Array();

// Currently playing song
var cps:Number = -1;


// Load the songs XML
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
    var nodes:Array = this.firstChild.childNodes;
    for(var i=0;i<nodes.length;i++)
    {
        sa.push(new Song(nodes[i].attributes.url, nodes[i].attributes.artist, nodes[i].attributes.track));
    }
    playSong();
}

trace(text);
xml.load(text);

function playSong():Void
{
    s = new Sound();
    //s.onSoundComplete = playSong;  
    s.setVolume(75);
    mute.gotoAndStop("on");
    if(cps == sa.length - 1)
    {
        cps = 0;
        s.loadSound(sa[cps].earl, true);
    }
    else
    {
        //s.loadSound(sa[++cps].earl, true);
    }
    trackInfo.text = sa[cps].track;
    playPause.gotoAndStop("pause");
    textPos = 0;
}


I get these errors when I test it. Mind you that _level0.text get's the value from JavaScript so that last error really works.

QUOTE
Error opening URL 'file:////Venus5/multimedia/Interactive/MMED%5F0025%20Elvis%20Collectable%20Tins/Xtras/Javascript%5FTalking%5Fto%5Fflash/undefined'
Error opening URL 'file:////Venus5/multimedia/Interactive/MMED%5F0025%20Elvis%20Collectable%20Tins/Xtras/Javascript%5FTalking%5Fto%5Fflash/_level0.text'



Is there a way to block this first error? or can anyone tell why it comes up?
I just don't understand why it comes up undefined the first time & it's so close to being complete. Plus I'm sure alot of people would use this as a tutorial, because there's not much out there on this.

Thanks,
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


bmcc81
post 7 May, 2008 - 10:41 AM
Post #2


D.I.C Head

**
Joined: 10 Jul, 2007
Posts: 70

I've solved that problem. icon_up.gif


So what I do is... Concatenate on .swf

So it looks like. There's also a couple places where you have to put the javascript-to-flash?text1=tracklist/TC2_52981.xml

Inisde <script> and also inside <PARAM NAME

javascript-to-flash.swf?text1=tracklist/TC2_52981.xml"

In my html where I embed my flash I put.

CODE
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab','name','testcommand','width','233','height','24','id','testcommand','src','javascript-to-flash?text1=tracklist/TC2_52981.xml','align','middle','quality','high','wmode','transparent','allowscriptaccess','sameDomain','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','javascript-to-flash?text1=tracklist/TC2_52981.xml','play','false','loop','false','flashvars','text1=tracklist/TC2_52981.xml' ); //end AC code
      </script>
        <noscript>
          <OBJECT
    CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" name="testcommand"
    WIDTH="233"
    HEIGHT="24"
    ID=testcommand>
            <PARAM NAME="MOVIE" VALUE="javascript-to-flash.swf?text1=tracklist/TC2_52981.xml">
            <param name="wmode" value="transparent" />
            <PARAM NAME="PLAY" VALUE="false">
            <PARAM NAME="LOOP" VALUE="false">
            <PARAM NAME="QUALITY" VALUE="high">
            
            <PARAM NAME="flashvars" value="text1=tracklist/TC2_52981.xml" />
            <param name="QUALITY" value="high">
            <embed src="javascript-to-flash.swf?text1=tracklist/TC2_52981.xml" width="233" height="24" align="middle" quality="high" wmode="transparent" name="javascript-to-flash" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />                
            <EMBED
        wmode="transparent"
        NAME="testcommand"
        SRC="javascript-to-flash.swf?text1=tracklist/TC2_52981.xml"
        WIDTH="250"
        HEIGHT="24"
        PLAY="false"
        LOOP="false"
        QUALITY="high"
        SCALE="SHOWALL"
        swLiveConnect="true"
        PLUGINSPAGE="http://www.macromedia.com/go/flashplayer/"> </EMBED>
          </OBJECT>
          </noscript>

User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Closed TopicStart new topic
Time is now: 5/16/08 09:46AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month