PDA

View Full Version : Pass variable from spot to swf


Panorado
12-09-2008, 03:48 AM
Note, I am not loading the FPP into the 'wrapper' (ie I am not loading it into a flash movie), it stands on it's own. When somebody clicks on a spot, I want to have that spot have an 'id' and that 'id' variable passed to a swf movie (I use SwishMax2 to creat my Flash Movies). It seems simple enough... easy with html>php>flash... but I have been trying for 2 weeks and no go... I am trying to make a site like this > http://www.peggy-huyn-kinh.fr/site/PHK1.htm < virtual 360 shopping site, and when somebody clicks on a product I just want one variable passed... please help if can.

Panorado
12-19-2008, 12:47 AM
Really... This shouldn't be so difficult... I've spent days trying to get a simple variable from a spot into an .swf.

I tried putting a local connection in the spot (to send the variable) >

<box
id="p001"
productid="p001.jpg"
url="files/box.png"
pan="54"
tilt="20"
alpha=".5"

onOver="
alpha=1;
"
onOut="
alpha=.5;
"
onClick='
buttonMode=0;useHandCursor=0;
display.visible=1;
close_button.visible=1;
var sending_lc:LocalConnection = new LocalConnection();
sending_lc.send("SendProductID", "methodToExecute", "p001.jpg");
'
/>


I also tried just making my own variable (see above "productid") and capturing it in the .swf movie but nothing...

When I click a box... I just want to send one variable (from that spot) to my flash movie... should be simple....

allSaints
12-19-2008, 07:10 AM
It's unfair.

Because it is so conveniant to talk to an external plugin, but not as easy to communicate with a "smart" hotspot plugin. I am a bit surprised - I would have thought it would be the other way around.

In the case of an external, you just change an attribute in the XML file, and FPP immediately call the setAttribute() function in the plugin.

When it comes to the hotspot swf, you have to set up a timer that regularly checks an attribute to accomplish the same thing. The difference being that the plugin has to take the initiative. At least I havn't found any other way to communicate...

Tommy

Panorado
12-19-2008, 05:48 PM
Why didn't I think of it...??!!! Anyways... I was going through every thread on this forum (again... my brain is not retaining info well these days) and stumbed accross this thread >

http://flashpanoramas.com/forum/showthread.php?t=1913&highlight=spot+button

And, there it was... so Simple!! Now, this is working for me... this is "a" solution... don't know if is THE solution but it's easy and working great!

To pass a variable from a spot to another .swf loaded in a spot, simply declare a querry string URL in the spots "url" variable.

Example:

Normal -

<spot
id="p001"
url="001.swf"
static="1"
staticX="0"
staticY="0"
/>

Pass Variable -

<spot
id="p001"
url="mymovie.swf?id=1"
static="1"
staticX="0"
staticY="0"
/>

In my "mymovie" movie I didn't even have to use FlashVars or anything... I can use "id" strait in the code! So Simple!

I hope this works for anybody that want to use it... and I'm not leading people down the wrong path... but, should work.