Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Thanked 0 Times in 0 Posts

    Flash Vars not working...

    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
    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" />
    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?

  2. #2
    Senior Coder
    Join Date
    Mar 2003
    Thanked 30 Times in 28 Posts
    Seems to me that you are over complicating this too much.

    Are you against using SWFObject? I'd recommend it against using the FlashVars parameter as its a lot cleaner and a better way to embed flash movies in my opinion.
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts