ActionScript 3.0 :: Passing Variables To Child MC?

Jul 23, 2009

I've been using Flash for years but only recently started doing anything with AS3. I am using SlideShowPro and SlideShowPro Thumbgrid which are both AS3 components, hence the move. I am finding the move incredibly frustrating.Anyway, on to my problem. My parent movie is loading a child SWF. The child SWF needs to read a variable from the parent but I can't work out how as the old syntax is not working.My loading AS looks like this:

ActionScript Code:
var loadit = new Loader();
addChild(loadit);

[code].....

View 9 Replies


Similar Posts:


AS3 :: Flash - Passing Variables From Parent To Child?

Oct 14, 2011

I'm trying to access some variables from my parent in my child MC.

Parent code:

var data_history:String;
function finish_checkUp(event:Event):void{
var checkUp_stat:String;

[Code]....

Now as you can see, i have tried the trace method, but with no luck. Flash doesn't report any errors regarding the trace method, but does report the two undefined vars (data_history). Ive tried to use the trace method above all the functions, at the top of the script, still the same errors though.

View 2 Replies

ActionScript 3.0 :: Passing Variables To A Child After It Is On The Stage?

Sep 30, 2009

I am not sure if I'm being completely stupid here, so my apologies in advance. If I have an object on the stage for example:

ball:Ball = new Ball();
addChild(ball);

it already has .x and .y values as it is placed on the stage.Then I have some value inputs, such as force, angle etc.Now when I click an event listener I want it to activate a function in Ball that will move it from the values I have just set.My question is how do I carry those values across after the ball has already been place on the stage?

View 4 Replies

ActionScript 2.0 :: [Flash8] Passing Variables To Child.swf?

Jan 7, 2007

how to pass variables from a parent swf to a child swf loaded into a movieclip container within the parent swf.

View 6 Replies

ActionScript 3.0 :: Passing Variables From Parent To Child SWF

Apr 17, 2009

I have a Parent.swf which loads a child.swf.this is a desktop application and the problem is

while loading the child.swf i have to pass a variable from parent.swf to child swf. how can i do it.can anyone give me an implemented code.

View 9 Replies

ActionScript 2.0 :: Passing Variables From Parent Flash Into Child?

Jul 26, 2010

how can I pass a variable from a parent flash file to a child flash file which it calls?We have a parent flash file which imports various child flash files based on instructions in an XML file. It's probably easier to see an example - opg2DOTcoDOTuk/flash/yay.html (replace the DOTs, couldn't post an url due to restrictions) - the text above each page, and the 'enlarge page' lightbox links are all in seperate flash files (one per double page) which are brought in, depending on the pages you are looking at, based on the instructions in an XML file which looks like this...

<page ani_swf="pages/text1.swf">pages/white.jpg</page>
<page ani_swf="pages/text1.swf">pages/0001.jpg</page>
<page ani_swf="pages/text2.swf">pages/0002.jpg</page>
<page ani_swf="pages/text2.swf">pages/0003.jpg</page>

etc, where the swf is the header flash file containing the text and one or two lightbox links, and the jpg files are the page images that appear.We had to repeat the imported child flash file because of a glitch when you go backwards through the book otherwise.

This system has been fine for us up until now but recently we've had to look at making it a dynamic system, so the content of the book can be varied depending on a variable being passed into the parent file via FlashVars...

<param name="FlashVars" value="zone=1" />
<embed src="newbook3.swf" FlashVars="zone=1" ....etc

This makes the book load an xml file called "1"). This is fine, except we also need to vary the 'enlarge page' target images to match.The 'enlarge page' links are currently hard coded into each child flash file, like this...

on (release){
getURL("javascript:SWFDelegate('imagename.jpg','Ex ample');");
}

- What we've tried so far:

1. Trying to pass the variables in querystrings from the XML
eg.

<page ani_swf="pages/text2.swf?var1=image1&var2=image2">pages/0002.jpg</page>
<page ani_swf="pages/text2.swf?var1=image1&var2=image2">pages/0003.jpg</page>

with the child flash setting it's action like this...

on (release){
var image1 = var1 + ".jpg"
getURL("javascript:SWFDelegate(image1,'Example');" );
}

I'm not sure if the syntax here is correct. We have to add the ".jpg" in here because, as far as I understand it, you can't pass "." in a querystring.

2. Passing the variables for the child into the parent

I read somewhere that variables passed to a parent are automatically available to a child. Not sure if this is true, but it didn't work for me when I tried it like...

<param name="FlashVars" value="zone=1?var1=image1&var2=image2" />
<embed src="newbook3.swf" FlashVars="zone=1?var1=image1&var2=image2" ....etc

Combined with...

on (release){
var image1 = var1 + ".jpg"
getURL("javascript:SWFDelegate(image1,'Example');" );
}

...in the child button action.

View 2 Replies

ActionScript 3.0 :: Passing Commands From Child To Child?

Aug 19, 2009

I have a main movie (main.swf). I load child1.swf and child2.swf into it with URLLoader. Is there any way to make a button to child1.swf which would take a user to some frame in timeline of child2.swf?
 
Something like
parent.child2.goToFrame(5);
 
I have tried different combinations without luck...

View 8 Replies

ActionScript 3.0 :: Passing Values Child To Child?

Jul 8, 2009

I am a bit of a noob, and I'm having a problem. I had posted about this before but I think I was explaining what I need to do in way to much of a complicated manner so I'm going to try and simplify this a bit. I have 5 swf's.

- main.swf (parent)
- child01.swf
- child02.swf

[code]......

View 2 Replies

Passing Variable Value To Child Movieclip?

Oct 26, 2009

I have a movieclip that will load an external picture from a given path, it works fine if I hardcode the picture path. In the scene I added this moveclip at runtime, but now I have problem to pass in the a string path value to the movieclip so that in can load a correct picture.

View 2 Replies

ActionScript 3.0 :: Passing Information From A Child To A Parent?

Oct 29, 2010

I need to pass information from a child component (Flashbuilder 4) up to its parent.

The information comes from an event object. Do I need to use a custom event?

View 0 Replies

ActionScript 3.0 :: Passing Txt Variable Through Parent To Child?

Apr 7, 2011

I have a simple BOOK script where I have 10 pages (for example purposes). Each page has a vocabulary word on it. Currently, I simply created a vocabulary MC separately for each page and it works fine. Problem is, that leaves me with 10 Vocabulary pages and I would rather have 1 that loads info based on a var on the main page.

WORKING SCRIPT
var loaderZ:URLLoader = new URLLoader();
loaderZ.dataFormat = URLLoaderDataFormat.VARIABLES;
loaderZ.addEventListener(Event.COMPLETE, loading);

[Code].....

I am getting the word "depressed" from page 1 (verified by trace) Unfortuntely this does not work.

If I change the last line of code to:

VocText.htmlText = loaderZ.data = word;

Then it outputs the word DEPRESSED to the text field VocText but does not return the value from the txt file.

View 2 Replies

ActionScript 2.0 :: Passing A LoadMovieNum Into A Child Movie?

Dec 8, 2002

I'm populating a Dynamic Text field with content from an external flat text file.To load the text file I have a frame action: loadVariables Num("flash.txt", 0);This works fine when viewed by itself.The problem is when I load that Movie into the Parent (container) SWF file using loadMovieNum - it will no longer work.

View 5 Replies

Passing A State To The Child Button Of A Flex4 ButtonBar?

Apr 16, 2011

I have a Spark ButtonBar that has a custom skin, which defines a custom skin for the "middleButton" requirement. My CustomButtonBarSkin has a custom state, minimized, which I want to pass into my middleButton skin so it can modify its design.

Is it possible to do this? I can see that my button skin could use parentDocument.currentState to get the minimized state, but that's really ugly. Any way to pass a skin from the bar to the child button(s)?

View 4 Replies

Flash :: Passing Data From Parent To Child In ActionScript3?

Nov 10, 2011

I have two swf, A.swf and B.swf: B.swf is a child of A.swf.i want to access the variable of a.swf in b.swf.Is it Possible?How Can i do this?

[Code]....

View 3 Replies

ActionScript 3.0 :: Load Child Swf In Different Domains And Passing Params?

Mar 24, 2011

I have a parent swf that loads a child swf and attempts to pass some data into the child.

The process works fine if parent and child are located in the same domain (lets say domainA.com).

As soon as I place the child swf into domainB.com and try to load it, it will load in the parent, but it is not loading the values.

Crossdomain policies are in place (the child does load!), but the params are not sent.[code]...

View 0 Replies

ActionScript 2.0 :: F 8 - Passing Variables From One SWF To Another?

Feb 8, 2009

I have a swf with an input text box and a button. When the button is clicked, I need it to open another swf in a new window on a different domain and pass the variables to a dynamic text box in the new window. I looked at local connect but I wasn't sure it would work because the two windows wouldn't necessarily be loaded at the same time and they are on different domains.

View 4 Replies

Passing Variables Between .swf Files?

Sep 9, 2009

I am loading images into a movie clip dynamically from an XML file. Based on what image the user clicks, I would like to be able to open a separate window, displaying a different image. Ideally, I'd pass the variable of which image was selected to the new open window.I've done some research online, and am thinking I'm making this harder than it needs to be.

Actionscript from main movie

Code:
chosenImage.onPress = function() {[code]......

I've also seen where I could possibly pass a variable through ASP.NET, but am experiencing the same errors when trying to pass the variable. I suppose I could embed the popup.swf file in a new .aspx page, that would probably be acceptable.

View 1 Replies

ActionScript 3.0 :: Passing Variables On URL?

Jan 6, 2010

I'm using IE 8 and trying to open an HTML file. All files are either local or ran on a server. Problem is I use the URLVariables object, and they still won't get passed. for example:

Code:
var req:URLRequest = new URLRequest("Y:/htmlFile.html");
var urlVars:URLVariables = new URLVariables();

[code].....

View 14 Replies

ActionScript 2.0 :: Passing Variables Between Mc?

Jul 21, 2010

I just want to show the contents of the input data in Movie Clip Movie Clip A into B which is still in one layer.

View 2 Replies

Passing Variables Between MovieClips?

Sep 6, 2010

I'm trying to develop a site map, which draws a tick over the sections of my app that have been completed. I've figured out how to draw the tick and how to pass variables from root to the MovieClip that the function is in.

To make the tick appear only after an mc has been watched, I tried setting a variable equal to 1 ino the last frame of the MovieClip, and telling the function to run if that variable was 1.

I'm not getting compiler errors, but I'm also not getting the tick. And I'm definitely completing the Movie

Here's what I've got so far: In root

Code:
var xcoord = 125;
var ycoord = 300;
var WaterComplete = 0;
In WaterMovie

[Code].....

View 3 Replies

ActionScript 3.0 :: Passing Variables Between Two Swf's?

Nov 25, 2008

I am trying to pass value and string from AS3 main.swf to AS3 child.swf loaded in it. But, Nothing is working and i can't get the value from one to another. As Beginner in AS3, i was working for a long time and
still i face these problems and no output yet.

[Code]...

View 1 Replies

ActionScript 3.0 :: Passing Variables To PHP

Nov 17, 2010

I am having some trouble in passing variables from AS3 to PHP. I am using flash and php both in the same file [try.php]. I've stuck with this for two days.. Here's what I have done. header.fla [Actionscript in the timeline]

[Code]...

View 5 Replies

PHP :: XML - Passing Variables From Flash

Sep 4, 2010

Creating a flash project where users can visit the site, and turn off/on objects in a house (ie. lights, tv, computer, etc.) The next user who will visit the house in the website, will see what lights or house appliances were left on. Flash variables are passed to PHP, and those variables are saved in an XML file. (For testing to see what is being saved to the XML file, on each click --vars.xml opens.) In the vars.xml file, I see that the house objects that were last turned on--are saved in the XML file- But in the SWF file, only one of the objects that are listed in the XML are turned ON. Only the last object that was clicked on would show ON--not all the objects in the XML file.)

package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.text.*;
import flash.net.*;
public class House extends MovieClip {
[Code] .....

View 1 Replies

ActionScript 3.0 :: Passing Variables To PHP?

Nov 19, 2010

I am having some trouble in passing variables from AS3 to PHP. I am using flash and php both in the same file [try.php].

I've stuck with this for four days.. Here's what I have done.

header.fla [Actionscript in the timeline]

Code:
stop();
import flash.events.Event;
import flash.display.Sprite;

[Code].....

View 5 Replies

ActionScript 2.0 :: Passing Variables From SWF To SWF

Sep 4, 2005

I am using FLASHVARS to pass a variable (Status) from ASP to Flash.This piece of Flash (named Header), calls another SWF (named InOutPencil) using this command:[code]My problem occurs when I try to use the Variable 'Status' in the InOutPencil SWF (below).[code]I need a way of passing the value of the variable 'Status' from Header to InOutPencil.

View 3 Replies

ActionScript 2.0 :: Passing Php Variables?

Feb 24, 2006

I need to pass the following php information into flash...

<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$link = "<img src ="$mosConfig_live_site/images/comprofiler/tn";
$link_gallery = "<img src ="$mosConfig_live_site/images/comprofiler/";

[Code]....

This php script displays the top 20 users from a database based on their hit count. The script passes their avatar (image), username and link, as well as total hits.

I wanted to create a flash file with one movieclip that would parse the php file and display the results in an i++ fashion, so that I could make changes to only one mc instead of 20, when needed.

I have tried making a dynamic text field an mc, and assigning the loadvars object to that mc... but can't get any information to display... and I know the php file works like a charm.

View 10 Replies

ActionScript 2.0 :: Passing Variables Into A MC?

Nov 21, 2007

in my main movie, i have done a survey, see my previous thread which collects data from a series of radioButton groups. i can display this data using dynamic text boxes no problem, however i also wish to display this data in a separate swf which has been loaded into the main movie via a movieclip using

Code:
_root.cm_handler.loadMovie("movie2.swf");

View 1 Replies

ActionScript 3.0 :: Passing Variables From PHP?

Aug 31, 2008

i got this working in AS2 and PHP, but i can't use the VAR option on the dynamic text ... so how would i do this in AS3 ?

here's the simple code

using AS2 and PHP 5.2.6

ActionScript Code:
//
// create an object to store the variables
varReceiver = new LoadVars();
// load the variables from the text file

[code]....

and the PHP Code in info.php

PHP Code:

<?php$fName = "nuno";$lname = "mira";$age = 24;// echo or print the variablesecho ("&fName=$fName&lName=$lName&age=$age&");?>

View 6 Replies

ActionScript 2.0 :: Passing Variables Between .swf's?

May 11, 2002

I'm trying to get one movie to send a variable to another movie. how to check the string that's being sent, and have the movie do stuff based on what string is being sent (if (string=="bla"){gotoAndPlay("bla");}.

View 5 Replies

IDE :: Passing Variables Between SWF Files?

May 21, 2009

I have a flash file that I made that displays a scrolling newsfeed (I'll call it newsfeed.swf)... I published it to an SWF. Now, I created a new flash file that I would like to use to show many instances of newsfeed.swf. In my new flash file, I have the following code:

this.onLoad=function(){
mcNewsfeed.loadMovie(http://www.whatever.com/newsfeed.swf?s=MSFT);
}

In theory, when newsfeed.swf starts up, the ?s=MSFT variable should be passed in at the _root level such that I should be able to reference it and build the newsfeed to be displayed dynamically. I've tried several different things, but no matter what I do, the following code (the _root.s part) in newsfeed.swf returns "undefined":

newsfeedURL = "http://finance.yahoo.com/rss/headline?s=" + _root.s

I would prefer to not have to pass XML files between the swf files or use system objects as that would add a level of complexity I'm not ready to deal with (I'm a total noob at this stuff)...

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved