Flash Ram Player Example
Below is an example for the flash ram player, this is a more advanced version of the one i made for this previous post, Mental Ray Render Optimisation. The main difference is that it now loads in the images instead of embedding them so it is possible to use it for different situations without recompiling the swf file every time.
The flash file receives the url to the images you want displayed via flashvars, it then uses a loader to load the images and display the loading progress. The ram player as it is has some limitations, you can only use it for images 500 x 375px without having to change the action script code and at the moment it does not support the text summary's shown in the Mental Ray Render Optimisation post. I will add this functionality and post an update when i have time.
The download above has all the files that make up this player, the .fla file, and two action script classes. Main.as gets the flashvars urls and creates the loader, and also handles the changes in the slider. ImageLoader.as loads the images from a given url and displays the loading progress.
To pass the urls to the swf file it is a very simple process with flashvars. Below is the code used to embed the example above, i have used the swf object for this.
The important part here is the flashvars variables, leftImage and rightImage:
flashvars.leftImage = "http://www.xyz.com/left_image.jpg";
flashvars.rightImage = "http://www.xyz.com/right_image.jpg";
Remember the images need to be 500 x 375px and the swf file 500px wide for it to display correctly, unless you change the source code. If you make any additions to the code make sure you leave a comment and tell me about it.
2 Comments
Once again you’ve done an amazing job. It definitely got me going in the right direction.
You did forget to mention that the embed code only works if you have the swfobject.js file and include it in the head of the html document. It’s a very useful tool, I for one will probably never use html embedding ever again.
11:30 AM
05 Jun 2009
Harrison
Yes i did leave that out, there are plenty of good tutorials out there for using swfobject. Check these out if you need help.
swfobject home
Very good tutorial on using swfobject and flashvars.
11:36 PM
05 Jun 2009
Pieter Vanderwerff
Write a Comment
Name and Email are required. Basic html is supported in comments.
Name
Email
Website
Comment