473,396 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

AS3 - Passing values to child swf

15
Good morning, I've ran into a problem where I need to pass a value from my main swf to a external swf that I load. I've looked everywhere with no luck. Hope to find someone here that may know. What I am trying to do is pass the value of textColor to my Weather.swf. The textColor is a dynamic value that the user selects from the main swf. I'm still quite new to how AS3 handles different things. =(

Expand|Select|Wrap|Line Numbers
  1. [Frame1]
  2.  
  3. import flash.net.URLRequest;
  4. import flash.display.Loader;
  5. import flash.events.Event;
  6.  
  7. var textColor:uint = 0x00FF00;
  8.  
  9. //Creates empty movie clip 
  10. var Wmc:MovieClip = new MovieClip();
  11.  
  12. // Load Weather
  13. var WeatherLoader:Loader = new Loader();
  14. var WeatherRequest:URLRequest = new URLRequest("Weather.swf");
  15. WeatherLoader.load(WeatherRequest);
  16.  
  17. // MC Populated
  18. Wmc.addChild(WeatherLoader);
  19.  
  20. [Frame2]
  21.  
  22. // Format Wmc
  23. Wmc.x = 562;
  24. Wmc.y = 62.5;
  25. Wmc.width = 900;
  26. Wmc.height = 550;
  27. Wmc.name = "WMC_Loader";
  28. addChild(Wmc); // Display the Wmc
  29.  
  30.  
Any information would be great, thanks.

-John
Jul 31 '08 #1
1 12545
bnashenas1984
258 100+
Hi
I'm not sure if this example can help you or not.

Lets say we have 2 swf files

Number 1: main.swf
Number 2: loadedFile.swf

first you load loadedFile.swf .and add it to main.swf and then set the instance name to "loadedFileName"

Now we want to pass a variable called "Something" to loadedFile.swf

in main.swf we write
Expand|Select|Wrap|Line Numbers
  1. loadedFileName.Something = "here comes the value of your variable";
  2.  

and now if you write the code below you will see the value of your variable in the output box
Expand|Select|Wrap|Line Numbers
  1. trace(this.Something);
  2.  

Good luck
Aug 14 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Mike M | last post by:
Is it possible? In the parent process, I have a socket that binds, listens and then accepts new connections (which creates new sockets in the process). I want to be able to pass some of these new...
1
by: cirillo_curiosone | last post by:
Hi, i'm new to javascript. I started studing it on the web few weeks ago, but still haven't been able to solve one big problem: HOT TO PASS VALUES FROM A SCRIPT VARIABLE TO A CHILD HTML...
1
by: Paul D. Fox | last post by:
I'm trying to launch a Child Window from a hyperlink on a Datagrid and have it recieve multiple values from the Parent Window. Upon recieving the values in the Child Window, I need to access them...
5
by: Stephen Travis | last post by:
I'm trying to ReDim a child object after passing the parent object as System.Object and it throws a System.InvalidCastException: Cast from type 'Object()' to type 'ChildType()' is not valid. If I...
0
by: ssrivani | last post by:
hi all, I have a parent window default.aspx which has a textbox(txtBox1) with multiline property and a button.when the button is clicked a child window pops up child.aspx. I have four textboxes...
1
by: gajahkursi | last post by:
<?php // Connect database include("conf.php"); $child= $_POST; // Get all records in all columns from table and put it in $result. $result=mysql_query("SELECT * FROM parent WHERE child=...
1
by: pingalkar | last post by:
Hi, In my application, I call one popup winodow by using this link.. <a href="#" onClick="return showWindow('1','XYZ');"> <img src="images/magnifier.gif" ALT="Chemicals"...
1
by: jiaudheen | last post by:
hi i have a multiline textbox and a button in parent form. in the child form i have text boxes,comboboxes,button. the thing is i click the button in the parent form ,the child form opens. i fill the...
6
by: raylopez99 | last post by:
This thread is about how variables or parameters (including objects) are passed between forms (namely, using parameterized constructors, e.g., to pass an int between forms (e.g., a calling form and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.