Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 18th, 2002, 11:27 PM
dstefani dstefani is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 10 dstefani User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[MX] LoadVars - Php

I am trying to get a movie to load a sound file (mp3) from a variable I set in a Php script. Everything works fine when I loadSound from a static link, but I can't find a good example of using a variable as an argument.

// Here's the action script: ////////////////////////////

stop();
getSound = new loadVars();
getSound.load("http://localhost/calpass/scrSound.php");
varPlay = getSound.trans;


translate = new Sound();

_root.playButton.onRelease = function() {
translate.loadSound(varPlay, true);
//translate.loadSound("http://localhost/calpass/assets/sounds/intro.mp3", true);
translate.start();
};
_root.stopButton.onRelease = function() {
translate.stop();
};

// Here is the Php file: (simple for testing) ////

<?
$outSound = "trans=http://localhost/calpass/assets/sounds/intro.mp3";
echo $outSound ;
?>

// Here's the error I get when I testMovie in flash MX //////

Error opening URL "file:///G|/CAL%5FHS/www/assets/flash/"

When I put the swf file into a web page within a live site nothing happens.

I sure could use some help. I'm new at action script and I'm having a hard time finding a good reference for this.

Thanks,

Don

Reply With Quote
  #2  
Old July 22nd, 2002, 12:56 AM
imbrokn imbrokn is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: NJ
Posts: 428 imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 34 m 8 sec
Reputation Power: 10
Send a message via AIM to imbrokn
I'm not sure if this is your problem but it is something that you should look into. When you are loading variables with flash, the script won't wait for the variables to be loaded if you are loading them form an external source. So when you are trying to use the variable that you loaded from the php script, its not seeing a value becuase it isn't loaded yet. The only solution i found is this. The variable string that you are sending back, add a value at the end of it like "isLoaded=1", so your php file will be something like this:
PHP Code:
echo "sound=http//yoursound.mp3&isLoaded=1" 


Then in your flash movie, on the first frame call your load function, then on the second frame do a check for isLoaded == 1. If it is jump to something like frame five, and there is where you can put the rest of the code. Otherwise, make sure that frame four jumps back to frame 2 to check if isLoaded == 1. In effect you'll be looping between frame 2 and four until your variables are loaded. then you will jump to frame five, and all your variables are loaded. I hope i made some sense.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > [MX] LoadVars - Php


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway