Flash Shopping Cart

Hi I am looking for a little advice on the best method to try and resolve a flash data issue.
I bought PPCC - great component and support, but I can’t get past something that has cropped up that I did not know about. The data sent to the shopping cart is not carried through from .swf to .swf - (The cart empties).
I was given this advice, but I am not sure what to do- or shall I say the best way to do it.

“I’m sorry to say, but that is the nature of flash. Multiple flash files will not automatically share variables/data across web page loads. It becomes quite complicated to do so. There is an easier way, and although I cannot give you much further support in this regard, you may want to consider having one primary flash file that loads in the various other swfs into itself using loadMovie() type actionscript commands…”

_ I guess if anyone here could help that would be great.
Thanks Tom

  1. What is PPCC…?
  2. If it doesn’t work with multiples swf’s, just use only one…?
  3. If you need to use more than one, use a sharedObject to store/retrieve the data
    (need to set the path so all swf’s access the same SO)

store all your variables in the _root timeline, then retrieve them as _root[myVariable]

Sorry, But I don’t know how to do what you are suggesting, I have been with flash sice version 1 or 2, but I am more of an artist than a coder. I can hold my own, but I can’t make this work. The site is www.insanefoamies.com.
Any othe advice on how to get the for sale section to work right- when you go to different pages the cart clears.
Thanks again
Tom

Perhaps you need ot create an array when someone begins shopping. Call the array _root.myArray() or whatever, but prefix it with _root. Then whatever you add to the array will be accessible from any loaded swf just be saying _root.myArray().

Then the array becomes the actual cart, containing all the items that the person has ordered. Using a nested array, you could include item details like quantity and price.

It’s easy to share variables from swf to swf, so long as they all share the same _root timeline. In case you are still not with it, the _root timeline is the timeline of the initial movie. You have to load new swfs into levels or movieclips, of course, and any new variables you create, make sure they are prefixed with _root.

I can’t explain much more without writing a book, so have a look on this site for arrays or variables if any of this interests you.

Carixpig - To be totally honest I can’t grasp the concept of where to place the code. Do you have an example, or could you look at this? www.insanefoamies.com/1.fla
and www.insanefoamies.com/2.fla
Sorry and Thanks Tom

I didn’t check out your flas, but here is a sample of what I mean. There is an array in the main movie, which gets added to by the loaded movie clip. The loaded movieclip can then retrieve the values in the array.

The point to take note of is that the array is in the main movie (the _root timeline), but the array is used by the loaded clip, which has its own timeline.

Good luck, just check out arrays and levels in flash for some more info.

Carixpig - Thanks for the help, but it is still not working.
Anyone can see what it does here www.deltacp.com/x/main.swf
and the fla’s are here www.deltacp.com/x/shopcart.zip

Yesterday I tried to get the tutorial
Transitions Between External SWFs (found on this site) to do the job, but same result.
Can someone please help?

Thanks Tom