PDA

View Full Version : Flash Vars not working...



tomyknoker
03-25-2007, 02:25 PM
Hi all,

I am trying to use Flash Vars to pass images, I have this code on the first frame of my timeline



var a = myVar.slice(0,myVar.indexAt("#")); //the string before the # character
var b = myVar.slice(myVar.indexAt("#")+1,myVar.length); //the string after the # character
randomImageURL = a+(random(6)+1)+b;//random image 1-6
target_mc.loadMovie(randomImageURL);
debugger = FlashVars.indexOf("#")+"/"+FlashVars.length+"="+FlashVars;


The idea is that it should load 1 of 6 random images, the developer wants to just be able to add say 'images/whatevername'5'.jpg' so that they can use the file anywhere. But the Flash Vars aren't working correctly I have been able to get it to work with myURL, but not with the images. This is the code on my HTML file, if anyone could help would be greatly appreciated



<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="745" height="110" id="variable_url" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="heardit_header.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="FlashVars" value="myURL=http://www.apple.com&myVar=images/#.jpg" />
<embed src="heardit_header.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="variable_url" FlashVars="myURL=http://www.apple.com&myVar=images/#.jpg" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>


When I run the file, and look in my activity viewer of my browser I can see the error which is it can't find an image which it is looking for but the directory is all screwed up it is looking for /images/#.jpg4mages/#.jpg really it should be something like images/image4.jpg Any ideas anyone?