# SWF and variables

**URL:** <https://forum.kirupa.com/t/swf-and-variables/102621>\
**Category:** Uncategorized\
**Created:** [February 25, 2004, 3:03pm UTC](https://forum.kirupa.com/t/swf-and-variables/102621 "2004-02-25T15:03:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [February 25, 2004, 3:03pm UTC](https://forum.kirupa.com/t/swf-and-variables/102621/1 "2004-02-25T15:03:14Z")

</div>

Currently I’m tryin to do catalog on CD using flash. There will be 15 pages of items w/ the selections. The coding I’m using for their options is from this:[http://www.kirupa.com/developer/mx/components.htm](http://www.kirupa.com/developer/mx/components.htm)

Now my question is, since I can’t use a DB because it’s on a CD, I have to pass the variables through flash. But when they are done making all their selections how do I make an externally loaded SWF using this command:

[AS]{  
getURL(“7072summary.swf”, “\_level1”);  
}[/AS]

read the final values that were selected on the specified pages?

I’ve read lots of the threads concering passing variables and none of them helped me.

Can anyone help?  
Also if anyone knows of any way to hold a DB on a CD and be able to write to it as well as read from it lemme know :thumb:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 25, 2004, 3:34pm UTC](https://forum.kirupa.com/t/swf-and-variables/102621/2 "2004-02-25T15:34:13Z")

</div>

ok. i’m not sure exactly how it’s done but i was a junior programmer on a flash project very similar to the one you are describing.

we had a virtual lab with 36 selectable items and depending upon what the user chose, a new page would be dynamically created with their selections.

if i remember correctly, on the 1st frame of the main timeline we created a new object and listed each item that could be selected in there:

selectableObject=newObject();  
object1[0]=“first object”;  
object2[1]=“second object”;  
…

selectedItems=""; // you’ll populate this empty variable with their choices

then, as the user chose their items, the selectedItems variable would be populated then pulled up on the request page.

does this help a little?

fumeng.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 25, 2004, 3:52pm UTC](https://forum.kirupa.com/t/swf-and-variables/102621/3 "2004-02-25T15:52:06Z")

</div>

Hmm… I understand what you’re saying, but my main problem is figuring out how to make an external SWF read the stuff that has been populated.

So basically SWF1 would be the whole movie w/ 15 pages of dropdown boxes, checkboxes, inputboxes, etc. I say 15 pages cause I’ve done a book animation thing to represent a catalog.  
Say the pages hold the following:  
Page1 - garmet 7072  
Page2 - garmet 7071  
Page3 - garmet 7070

On the last page will be a summary page, with probably only a list of available garmets ie:  
7072  
7071  
7070

Click one of them and it calls the populated info from say Page1 which is the 7072, and puts it in an external SWF 7072summary.swf.

BTW I don’t want to use the LocalConnection feature. UNLESS I absolutely have to.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 25, 2004, 3:57pm UTC](https://forum.kirupa.com/t/swf-and-variables/102621/4 "2004-02-25T15:57:24Z")

</div>

an external swf will be able to read the selectedItems variable you are populating.

think of it like this: your main movie is a shell movie that calls external swfs into it.

if you declare your new object and your selectedItems variable on the first frame of the shell movie, the external movies will be able to reference them simply by using \_root. or you can make selectedItems a global variable that can be referenced as well.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 25, 2004, 4:03pm UTC](https://forum.kirupa.com/t/swf-and-variables/102621/5 "2004-02-25T16:03:57Z")

</div>

Hmm… yea I tried that b4 I posted here and for some reason it didn’t work I read that in another post as well… I dunno try d/l the .fla from the end of this tutorial:[http://www.kirupa.com/developer/mx/components.htm](http://www.kirupa.com/developer/mx/components.htm)

See if you can get that populated information into another movie like I’ve described.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 25, 2004, 5:28pm UTC](https://forum.kirupa.com/t/swf-and-variables/102621/6 "2004-02-25T17:28:14Z")

</div>

ok. i just finished the tutorial and got it to work. so your movie should work along similar principles, no? where are you having the difficulty?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 25, 2004, 5:59pm UTC](https://forum.kirupa.com/t/swf-and-variables/102621/7 "2004-02-25T17:59:49Z")

</div>

Ok, make a button that calls an external swf

[AS]on (release)

{

```
getURL("summary.swf", "_level1");

```

}[/AS]

Now here is where I can’t call up the information. Once I call up the SWF it won’t seem to reference the base movie.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 25, 2004, 6:07pm UTC](https://forum.kirupa.com/t/swf-and-variables/102621/8 "2004-02-25T18:07:14Z")

</div>

ok. i see what’s going on. you’re calling a separate flash movie and you’re trying to pass variables from 1 movie into another. i didn’t understand that at first.

is there any way where you make the second movie (summary.swf) part of, instead of separate from, the main movie?

so instead of:

[AS]on(release) {  
get URL();  
}[/AS]

you have an empty movie clip with an instance name of placeholder that calls summary.swf into the main movie where it will easily be able to reference the variables.

[AS]on(release){  
\_root.placeholder.loadMovie(“summary.swf”);  
}[/AS]

know what i mean?
