ActionScript 3.0 :: Load External Swf And Set As Typed Variable?
Jan 28, 2010
So I have ClassA and ClassB. Each of these is the document class of two different FLAs. In ClassA I want to load a SWF and set it to a variable of type ClassB. The problem is that ClassB uses a ComboBox, so when I try to type the varialbe, then ClassA complains that it can't fine the definition for ComboBox. If I add the ComboBox component to the library of ClassA it works just fine. But that kind of defeats the puprose of me creating the seperate SWFs in the first place... smaller file sizes. So here is basic code of what I'm trying to do.
Code:
package
{
import ClassB;
public class ClassA extends Sprite
[Code].....
If I don't try to type the variable "swf" to ClassB then it works absolutely fine. But I want to have it typed so that I can then use intellisense/code completion in my IDE and not have to worry about the compiler telling em that functions don't exist on ClassB when I try to use them and such.
how to accomplish this? I have found that I can have ClassB implement an Interface and then set the swf to type IClassB... but I really don't want to have to do that because that means for all swfs I want to load I will have to create another Interface and prototype out all the functions. That just seems extremely tedious as this project will get very big.
View 2 Replies
Similar Posts:
Jun 21, 2010
im currently working on a flash component (first time). I have an instance of my component dragged onto the stage. Played around with changing the different properties i made inspectable - so here it comes: The property (typed object) i would like to change can not be edited in the IDE. I have no plus icon to add a new name-value pair to the list
[Code]....
and a screenshot of my empty panel where i would like to add some data:
View 2 Replies
Nov 26, 2008
It's early days in my AS3 learning, and I'm looking for a little clarification regarding a variable typed to a superclass (in this case var mySpinner:MovieClip) which contains a reference to an new instance of a subclass (in this case Spinner.) I am trying to get my head around why my code compiles and runs and I am able to call the method rotater() on mySpinner even though mySpinner is typed as MovieClip, and the MovieClip class does not contain the method rotater().
On page 163 of the official Adobe Programming ActionScript 3.0 documentation it says the following, which I believe is related to my situation, but I am still in need of clarification:
"Because each class defines a data type, the use of inheritance creates a special relationship between a base class and a class that extends it. A subclass is guaranteed to possess all the properties of its base class, which means that an instance of a subclass can always be substituted for an instance of the base class."
View 2 Replies
Apr 5, 2007
I think i am screwing up the syntax. let's say I have a global variable, like. _global.something = mymovie
And then, the code to load in the external swf.... loadMovie((something)+ ".swf", _root.ec); Well, it doesn't work, and I'm just not sure where to put the quotes, and how many parenthesis are needed. How do I use a global variable and access it for this loadmovie code?
View 1 Replies
Mar 18, 2009
If I have an external text file with a variable, (let's say it's called names) with a list of names,... how do I load that variable into an array in flash?. Does it have something to do with Split() to separate the different values on the list separated with commas?
let's say the external file is:
names=john, peter, veronica, alfred.
How do we load that in flash so we have something like:
[code].....
View 7 Replies
Jan 13, 2010
I want to be able to load an external text from an http request to a string in my flash application.
i know that with loadvars i can load variables, when the output is as: key=value&key=value.. but this is not the case here. i get in return a string with several random characters. how can i properly retrieve them ?
View 1 Replies
Dec 22, 2004
I have an external SWF file that is a dynamic chart. It normally requires (in the object and embed tags on the HTML page) a variable passed to it that points to an XML file.
What I want to do, is create a "container" program that simply has a few buttons, that when clicked load up that same chart.swf and point it to a different XML file.
What I can't figure out is how to get that external file to recognize it's dataURL parameter that it normally receives off the html tags. (BTW, I can't edit that chart.swf, it's a purchased product.) I tried setting a root variable of the same name in my container to point to a new XML file, but that doesn't work. I tried setting that variable, and using loadMovie with a GET to pass it the name, but that just looks for a string that flash seems to be interpreting literally, so it can't locate the file at all (I.e. it's looking for the literal name "chart.swf?dataURL=datafile.xml")
View 6 Replies
May 21, 2008
im trying to assign external data to a variable,var str:String = loadVariables("text.txt",_root.descPane);why it wont work?
View 2 Replies
Jan 29, 2009
i hav one main swf inside which iam loading second swf, but instead of hardcoding it, iwant the secound swf to calldynamically using variables.
The querystring is as follows:
<PARAM NAME=movie VALUE="film.swf?extSwf=movie.swf">
This method works fine:
[code]....
View 2 Replies
Oct 17, 2009
I need to load an external SWF into a movieclip, and get the name of the SWF from a variable from a class. The variable is called getSWF and is defined as
Code:
public var getSWF = "movie.swf";
When I trace(getSWF); on the first frame of the main time line it outputs fine. However when I use the following code on the movieclip :
Code:
var testtest= getSWF;
var imageRequest:URLRequest = new URLRequest (testtest);
var imageLoader:Loader = new Loader();
imageLoader.load(imageRequest);
addChild(imageLoader);
I get the error:
1120: Access of undefined property getSWF.
Though if I change the variable testtest to movie.swf it works fine.
View 1 Replies
Dec 22, 2004
I have an external SWF file that is a dynamic chart. It normally requires (in the object and embed tags on the HTML page) a variable passed to it that points to an XML file.What I want to do, is create a "container" program that simply has a few buttons, that when clicked load up that same chart.swf and point it to a different XML file.What I can't figure out is how to get that external file to recognize it's dataURL parameter that it normally receives off the html tags. (BTW, I can't edit that chart.swf, it's a purchased product.) I tried setting a root variable of the same name in my container to point to a new XML file, but that doesn't work. I tried setting that variable, and using loadMovie with a GET to pass it the name, but that just looks for a string that flash seems to be interpreting literally, so it can't locate the file at all (I.e. it's looking for the literal name "chart.swf
View 6 Replies
Feb 26, 2011
how to set up the URLRequest to load an external image to a movie clip that is being used in a Drag and Drop event.
I have successfully implemented the drag & drop code to my design but I would like to improve it by successfully loading external images to those objects that are being dragged around.
View 4 Replies
May 18, 2005
I have been working on a Flash movie that loads variable data from an external XML file and dynamically displays the item names in a menu which may then be clicked to display other dynamically-loaded content that corresponds to the menu item that was clicked. I have now come to a standstill in the project as there is something I'd like to achieve but simply cannot work out how. This is my first attempt at working with XML in Flash and one of my early attempts at using variables. What I'm trying to achieve is; once the user has viewed the item's content, they can simply click "next" and "previous" buttons to display all of the content for the next or previous items in the XML document.
I know it probably sounds simple and I'm sure some of you could achieve this in 5 minutes (!) but I can't get my head around some of the coding. I assume previousSibling and nextSibling would come into play here as well as some sort of functions which access arrays of data for the previous and next items, but I'm just not sure how to correctly put these things to use. Rather than post my code and example images of the stage up here on the forums, I've created an html page here: [URL]
View 2 Replies
Feb 8, 2010
I have 2 movie clips, one being loaded into a container MC via "loadMovie();"In the main movie there is a variable with no value, in the external movie there are 5 frames, each with a value to update the variable in the main movie.
IE: if on frame 1, global value = 1 / if on frame 2, global value = 2 / etc etc I'm familiar with passing variables INTO an external swf, but am stumped on how to do it the reverse way.
View 1 Replies
Sep 15, 2009
var loader:Loader = new Loader();
loader.load(new URLRequest("panghat spa.swf"));
addChild(loader);
want to load panghat spa.swf as a variable by pasing variable from html page in to flash
View 1 Replies
Jul 28, 2007
I'm trying to combine PHP/SQL and Flash. I've got a problem now. I want to load a variable that contains an url to an image. so the variable is like this: [URL] Now I want flash to load the image, not the text. The variable is called 'img1' but the loadmovie function doesn't work when I put it in.
View 2 Replies
Sep 8, 2003
I want to load an external variable called name from a text file into a local variable in flash called my_str...here's what I have:
var loadText = new loadVars();
loadText.onLoad = function(success) {
if (success) {
[Code]....
I need to have the variable my_str available outside the function..
View 3 Replies
Sep 10, 2003
I have a LoadVars object called loadText in which an external variable is loaded from a text file. Now, the whole thing works, I just want to create a template to optimize the system, so here is what I need: The external variable (in an external text file) is called page1. I am assigning that external variable to a local variable (at this point the external text has already been loaded in loadText, of course):
[Code]...
View 2 Replies
Jun 7, 2005
Is there a way of making a normal loadVars.load load a url depending on a variable you set in the swf?
var reciever = new LoadVars();
loadurl = "test_onload_3.cfm?propertyID="+MY_VARIABLE_GOES_HERE;
reciever.load(loadurl);
so that I can set my variable and then load the variables with the propertyID that I choose in the swf??
View 4 Replies
Jan 7, 2008
Im trying to make a SWF that sends some variables (query string) to ASP. Then the ASPfile is responding with "response.write". Everything works great except i dont know how to get the asp-answer back into flash again.I got a few variables that's added in a movieclip called form, then use this command on the button.in the flash button, (on release)
Code:
success = 0;
form.loadVariables ("http://xxxx/Code.asp", "GET")
in Code.asp
[code]....
View 2 Replies
May 28, 2007
Structure: There is 1 main file that loads external SWF files depending on what is clicked on.One of the external SWF files loads its text from external text files. This works fine when viewing the SWF applet on its own. But when viewing as a whole site, the text doesnt appear. Very annoying.I made that particular SWF on my mums computer running Flash MX 2004The flash file itself uses the Scrollbar component from MX.Could someone tell me why the text doesnt load in this scenario? It runs fine on its own, just not as an external SWF.
View 4 Replies
May 6, 2011
I have a Flex application that just load an external SWF, but the application load and unload infinitely my swf.
[Code]...
View 2 Replies
Apr 22, 2007
I am trying to get a nav button in one movie (main_nav.swf) to target a my main movie (index.swf) and load a sub nav movie (metals_subnav_infinite.swf) into it. The sub nav movie will do a similar task - loading a portfolio swf into main movie (index.swf). Here is the file breakdown of my working files:index.swf - main final movie which loads "main_nav_infinite3.swf" on startmain_nav_infinite3.swf - loads main nav "main_nav.swf" and scrolls it infinitely (infinite menu)main_nav.swf - main nav with buttons that trigger sub nav "metals_subnav_infinite.swf" to load into index.swfmetals_subnav_infinite.swf - loads sub nav "metals_subnav.swf" and scrolls it infinitelymetals_subnav.swf - sub nav with buttons that trigger "folio.swf" (have not created this file yet!) to load into "index.swf"The script I was focusing on is in main_nav.fla and it is:
metals_mc_bn.onRelease = function() {
reActivateMenu();
this.gotoAndStop(3);
[code].....
View 2 Replies
Mar 13, 2009
when I type j in the input box (or grid) component it looks like i. is it bug? when typed many j's.only first looks wrong.
View 2 Replies
Oct 9, 2009
how do you get the URL thats in the browsers address bar?
Code:
function getURLFromAB():void
{
var urladdress:String = // some command goes here
trace(urlAddress);
}
View 2 Replies
Jan 19, 2009
How do you load external library objects from an external swf? I want to have an external swf that only contains library objects that are exported for Actionscript, and load these from the master .swf file dynamically during the master swf execution. (I may have multiple external swf resource files)I want to be able to load the external swf, and then access it's library objects via actionscript in my main swf file.
View 6 Replies
Nov 17, 2010
as3 is new for me, but i would like to write a script using loader to load an external swf, and control the external swf. But I find I can't control the swf, because there are no fixed instance name. here is my script.
[Code]...
View 3 Replies
Sep 19, 2011
When i try to load an external swf file using Loader.Load(); The swf starts playing even before the init event is fired. Is there any way to stop the swf from playing atleast until the init event or complete event is fired?
View 1 Replies
Oct 19, 2009
I'm loading (and unloading) external swfs into a holder in my main document. However, they seem to load perfectly the first time, but after that, they load at a different x and y. I've seen this happen before in someone else's file, but I'm not sure what the solution is.
This is the bare bones of it:
Code:
sceneHolder.x=0;
sceneHolder.y=0;
addChild(sceneHolder);
[Code].....
View 1 Replies
Apr 11, 2009
Okay so I am trying to load external swfs which load videos dynamically.
I can load the swfs into the parent fla fine (if I remove all the code and just place a circle or something on the stage of the swf), and the swfs are also loading their respective videos correctly. But when I try to load the external swfs, if they contain any casting related code in them, I'm getting an error
[AS]TypeError: Error #1009: Cannot access a property or method of a null object reference.
at swf1_fla::MainTimeline/frame1()[/AS]
Is there some specific method to casting within external swfs?
My code for loading the videos is this:
[AS]var vc:NetConnection = new NetConnection();
vc.connect(null);
var vs:NetStream = new NetStream(vc);
[Code].....
View 1 Replies