PDA

View Full Version : Dynamin Image Display Problem


rhythmofrain
12-20-2004, 05:15 AM
I am displaying images in flash file retrieving the image path from asp files.
There is a form on asp page with three select boxes, in these three select boxes there are options to change the modelno, color and size of the image, the name of the image changes according to the option.

The problem is the variable(image) name changes on changing the option but the
loadMovie("http://192.168.0.6:2016/img/productImages/"+myVar);
is not refreshed everytime and the image remains the same.

In flash i have written
-----------------------
data_lv = new LoadVars();
_root.createEmptyMovieClip("empty_mc", 1);
data_lv.load("http://192.168.0.6:2016/product.asp");
data_lv.onLoad = function() {
empty_mc.loadMovie("http://192.168.0.6:2016/img/productImages/"+myVar);
}
-------------------------
and on asp page i have written
-------------------------
function doPassVar(){
mn=document.getElementById("group7").value
cn=document.getElementById("group6").value
sn=document.getElementById("group1").value
if(mn!="" && cn !=""){
img= new String("<%=image1Large%>")
p=img.lastIndexOf(".")
img=img.substring(0,p)
img=img+"_"+mn+"_"+cn+".jpg"
}
else{
img="<%=image1Large%>"
}
window.document.prodDisplay.SetVariable("myVar", img);

-------------------------
this doPassVar() function is called on onChange event of all three select boxes

I am able to load movie(dynamically) if i submit the form, but i want to do it without submitting the form.

uten
12-20-2004, 05:35 AM
you need to create a function in flash that loads the data using LoadVars. then call that function from your asp form using javascript. so let the javascript talk to the flash file to trigger the function and pass a variable. :)

jon

rhythmofrain
12-20-2004, 07:18 AM
Thanks jon,
I got it, but i am unable to call a custom flash function from javascript.
please help!

uten
12-20-2004, 07:44 AM
try this.. http://www.flash-here.com/tutorials/flash_from_js1.html

or this.. http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_04160

jon :)

rhythmofrain
12-20-2004, 08:41 AM
the setVariable method i am using to pass the variable from javascript to flash, and there are ways to call to methods of flash from javascript but i did not find how to call custom function in flash from javascript :confused:

rhythmofrain
12-21-2004, 03:37 AM
I have found the solution of my problem
I took a flag variable named process and pased it to flash
window.document.prodDisplay.SetVariable("process","1" );

and in flash i wrote
onEnterFrame = function () {
if (process == "1") {
empty_mc.loadMovie("http://192.168.0.6:2016/img/productImages/"+myVar);
process = "0";
}
}
now it is working properly