passing data from HTML to Flash
http://www.actionscript.org/forums/showthread.php3?t=125761
| #2 | |
| 
 Super Moderator 
Join Date: Jan 2002 
Location: Centreville, VA 
Posts: 25,003  
 | 
 Howdy and Welcome...  
![]() You have to use FlashVars to pass in the variables in HTML... Please check this thread... http://www.actionscript.org/forums/s....php3?t=125702 __________________ 
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer http://CyanBlue.FlashVacuum.com http://www.FlashVacuum.com http://tutorials.FlashVacuum.com Do NOT PM, Email or Call me... Your question belongs right in this forum...    | 
   | 
| #3 | |
| 
 Registered User 
Join Date: Jan 2007 
Posts: 31  
 | 
 ok, so i need the Flashvars tag/thing somewhere in the PARAM tag? so what/how would i get it in my action script, or would it have been loaded automatically and i can just refer to it where needed without anything like loadVariables("nnn" "mmm"); 
 | 
   | 
| #4 | |
| 
 Super Moderator 
Join Date: Jan 2002 
Location: Centreville, VA 
Posts: 25,003  
 | 
 If you provide the variable via FlashVars, you can access it like _root.variableName and it should work... and that's exactly what I have said in that thread...  
![]() __________________ 
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer http://CyanBlue.FlashVacuum.com http://www.FlashVacuum.com http://tutorials.FlashVacuum.com Do NOT PM, Email or Call me... Your question belongs right in this forum...    | 
   | 
| #5 | |
| 
 Registered User 
Join Date: Jan 2007 
Posts: 31  
 | 
 aye, atm i now have  
Code: 
<PARAM NAME=FlashVars VALUE="sr_title=dentist&sr_url=mo.flv"> and in the Actionscript i have Code: 
function SetValue() {showreel_title = _root.sr_titleshowreel_url = _root.sr_url}
Code: 
stream_ns.play(showreel_url);txtPlay.text = showreel_title & "Showreel Loading, Please Wait...";  | 
   | 
| #6 | |
| 
 Super Moderator 
Join Date: Jan 2002 
Location: Centreville, VA 
Posts: 25,003  
 | 
 Let's add some trace lines and tell me what you get... 
First, create a textField somewhere and give it an instance name of 'output_txt'... and add the following lines... ActionScript Code: 
 __________________ 
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer http://CyanBlue.FlashVacuum.com http://www.FlashVacuum.com http://tutorials.FlashVacuum.com Do NOT PM, Email or Call me... Your question belongs right in this forum...    | 
   | 
| #7 | |
| 
 Registered User 
Join Date: Jan 2007 
Posts: 31  
 | 
 I got this returned 
Code: 
showreel_title = undefined<br>showreel_url = undefined<br>_root.sr_title = undefined<br>_root.sr_url = undefined<br> Last edited by theste; 01-12-2007 at 04:05 PM..  | 
   | 
| #8 | |
| 
 Super Moderator 
Join Date: Jan 2002 
Location: Centreville, VA 
Posts: 25,003  
 | 
 Um... Are you testing it over the web browser??? What's your embed tag look like??? 
__________________ 
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer http://CyanBlue.FlashVacuum.com http://www.FlashVacuum.com http://tutorials.FlashVacuum.com Do NOT PM, Email or Call me... Your question belongs right in this forum...    | 
   | 
| #9 | |
| 
 Registered User 
Join Date: Jan 2007 
Posts: 31  
 | 
 heres all my code, well most of it 
Code: 
var connection_nc:NetConnection = new NetConnection();connection_nc.connect(null);var stream_ns:NetStream = new NetStream(connection_nc);stream_ns.play(showreel_url);txtPlay.text = showreel_title & "Showreel Loading, Please Wait...";output_txt.text += "showreel_title = " + showreel_title + "<br>";output_txt.text += "showreel_url = " + showreel_url + "<br>";output_txt.text += "_root.sr_title = " + _root.sr_title + "<br>";output_txt.text += "_root.sr_url = " + _root.sr_url + "<br>";//function SetValue() {showreel_title = _root.sr_title;showreel_url = _root.sr_url;//}my_video.attachVideo(stream_ns);stream_ns.play(showreel_url);stream_ns.pause();txtLoad.text = "LOADING";txtPlay.text = showreel_title & "Showreel Loading, Please Wait...";but_play._visible = 0;but_pause._visible = 0;this.loaded_txt(this.getNextHighestDepth(), 10, 10, 160, 22);var loaded_interval:Number = setInterval(checkBytesLoaded, 500, stream_ns);function checkBytesLoaded(my_ns:NetStream) {    var pctLoaded:Number = Math.round(my_ns.bytesLoaded / my_ns.bytesTotal * 100);    loaded_txt.text = Math.round(my_ns.bytesLoaded / 1000) + " of " + Math.round(my_ns.bytesTotal / 1000) + " KB loaded (" + pctLoaded + "%)";    progressBar_mc.bar_mc._xscale = pctLoaded;if (pctLoaded >= 15) {txtLoad.text = "READY";txtPlay.text = "Press Play When Ready";but_play._visible = 1;but_pause._visible = 0;}    if (pctLoaded >= 100) {        clearInterval(loaded_interval);    }}
Code: 
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="270" height="230" id="preloader" align="middle"><PARAM NAME=FlashVars VALUE="sr_title=dentist&sr_url=mo.flv"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="preloader.swf" /><param name="play" value="false" /><param name="loop" value="false" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="preloader.swf" play="false" loop="false" quality="high" bgcolor="#ffffff" width="270" height="230" name="preloader" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object> http://www.theste.co.uk/kaka/index.htm  | 
   | 
| #10 | |
| 
 Super Moderator 
Join Date: Jan 2002 
Location: Centreville, VA 
Posts: 25,003  
 | 
 That script should work on IE... But not in FF because you are not providing the FlashVars for the EMBED tag...  
Can you verify what I just said??? __________________ 
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer http://CyanBlue.FlashVacuum.com http://www.FlashVacuum.com http://tutorials.FlashVacuum.com Do NOT PM, Email or Call me... Your question belongs right in this forum...    | 
                    
                

 
                
            
        
浙公网安备 33010602011771号