Passing Flashvars Dynamically without reloading page


I am developing a flash file that will colour an image based on a hex value passed in from a flashvar field when the movie is loaded. This now works a treat thanks to help from Aneesh on here.

What would make it ideal is if I could update a flashvar and then get the flash movie to check for updated values and recolour the image accordingly. Being new to flash and especially actionscript, some hands on examples would be perfect.

I am passing in three flashvars
rg = a hex colour value such as 0xFFFFFF
rg2 = same as above used to colour a different movie file
urldesign = a filename of a transaparent background png image which i colour in from rg2 and display over a template that is coloured from rg.

I would like people on the site to be able to change the values of rg and rg2 on a form which submits the values to the flash movie and changes the colours when they click.

Any help appreciated.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you can do this:

Change = function (prop, oldVal, newVal, speedLimit) {
         /* change colors here.. prop is the name of changed variable, newVal is it's new value and oldVal old.*/

        /*this return must be here, otherwise the variable won't change value*/      
      return newVal;
//assuming rg, and rg2 are _root variables"rg", Change);"rg2", Change);

//anytime the value of rg or rg2 is changed, Change function is called....

hboysAuthor Commented:
Hi Ivan,

I need the form to be in a html document. If the user changes a value on the html form it passes over this new value to the flash movie which in turns changes the colour.

Aneesh ChopraCTOCommented:
Hi hboys,

firstly, you would have to send the variables values to flash
html can use javascript and setvariable function to send the updated variables to flash

here are complete Step by Step tutorials from macromedia on "javascript to flash" and "flash to javascript" communication


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Aneesh ChopraCTOCommented:

Also see the following post,
it explains how to use newly received values in flash
(Read my all comments in this post)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.