Flash :: Passing A MovieClip To An External Script?
Nov 4, 2010
I've created a class that contains all of the movie clips from the stage. These variables are referring to the instance's name on the stage. Everything seems fine as long as I keep all of my functionality in a single class. However, when I try to use another class to manage the properties of a movie clip, I run into resource clean up issues.
//File (MainScreen.as)
import utils.Container;
class MainScreen extends MovieClip
I want to create a MovieClip, pass this MovieClip to a function in another class where it will be modified.The problem is, when I pass the MovieClip as a parameter to a function and start making changes, the changes are only made locally. The "copy" of the MovieClip inside the function gets changed, but the "real" MovieClip back in my main game class remains unchanged. Here's the code from my Main class:
Code: var resourceLoader:ExternalResourceLoader = new ExternalResourceLoader(); var myMovieClip:MovieClip;[code].....
I have a object, called friends, It contains the url to facebook profile picture, ie friends.friend1 = "http:// etc"; I have a swf file called, master.swf, which is passed the information to create the object through flashvars. I need to get the object OR the flashvars info to the externally loaded swf, called pageOne.swf. I have seen and tried several different methods, but now seem to give me what I need.
I got an object into a class (a public one) called "squaddie0", and when i try to call it back from another class dynamically with :the main_class is the passed class, i get the vars like this : main_class.var1r index:int = 0;var ob:Object = (getDefinitionByName(main_class["squaddie"+index]) as Object;I get an error as an undefined object...Why that ?
I'm relatively new to Flash and ActionScript and have a problem with the following code I'm putting together:
Code: // creating a new testmclip object var testmclip = new testmclip(); // creating a new testmclip object /* create a new pop up menu - sending the testmclip as var and "test" as label */ popupmenu = new Menu ([path: testmclip, label: "test"]);
I'm trying to send a movieclip object created in one class, to a different class - for the latter class to add as it's child. The code was originally Kevin Hoyts Android Component for Menu and MenuItem [URL] ... but in that the path for the menuitem was a path which loaded from url or relative path --> this I can't do with flash...I think.
I want access MovieClips Dynamically from the external flash file.There are 5 MovieClips named Loader_1_mc, Loader_2_mc,.Loader_5_mc like so. Each of this movieClip contain 5 movieClips by named acc_1,acc_2, acc_5 like.How Can I access From the swf file. i tried few steps within nested loop.[code]
I have a map of the US acquired from here (called U.S. Map). I am currently generating XML from inside an ActionScript file, and would then like to display this map using my generated XML as the argument. According to this, to do this in html would require the following declaration:world.swf?ata_file=pathname/filename.xmlHow can I replicate this behavior using the Loader from ActionScript? Right now I have:
var ldr:Loader = new Loader(); var url:String = "us/us.swf?data_file=senate.xml"; var urlReq:URLRequest = new URLRequest(url);
i have a gallery that when any thumbnail is pressed it implements the following variable:[code] Now im trying to acces that variable "thumb" in ProjectFrame.swf but i cant seem to do it. Anyone know how I can pass the variable out?
I'm trying to have Flash execute a file, and I can get FSCOMMAND to work. Sort of. While I can use it to run a single batch file, what I really need to do is to pass a parameter from within Flash to the item being executed. I'm currently using Flash to allow a user to select some items, and I need to pass that selection out of it in order to kick off some other processes (Flash is basically just my GUI interface right now until I learn more about how to do things in it).
I don't care if it's a batch file or JavaScript or anything that's not uber complex (so no .NET or C++). I just need to find something that we can run internally for our company (either from an .HTML or a .EXE file output from Flash - not too picky there either).
I am loading an external child swf file into a MovieClip container in my main swf.I have a button in my child swf that when clicked, needs to be able to access a movieclip or variable that is in my main parent swf. How would I do this??
I am using a carousel with items in it...when the user clicks an item in the carousel, I want a new swf to load to _level0 and replace the carousel on the stage...the new swf reads an xml...however the xml should be different for every item on the carousel...is there any way to pass the xml file name to the loadMovie command so the new swf can use it?
I have a .exe file (it is a player) i need to pass a parameter to this player so it could play a specific file ( the parameter is the name of this specific file ).
I am working on a project where I have on the stage 8 movie clips, and when hovered, they are to shake. I have made this into a class, and placed the code as an external .as file.
Each movie clip is named shaker_mc - shaker_mc7
I have also gone in and changed all of the button movie clips base classes to ShakeButton.
Right now I am getting a couple of errors, and I believe all i need to do is pass the buttons names to the class in the external .as file, but I am not sure how to do that? I had everything working without the external script, but I did not want to have to create the effect for each button.
probably a hugely embarrassing beginner question, but I can't seem to find an answer anywhere. I think it's probably (hopefully?) just a syntax problem I'm loading the content of a dynamic text box from an external .txt file and I'm trying to find a way to change the content from a link in the .txt file (if that makes sense). The code I'm using to change the dynamic text box at the moment is:
I have two classes, DocumentClass and Icon. In DocumentClass I am instantiating Icon and in doing so passing it a number of arguments. One of the arguments is which symbol (MovieClip) to use in front of the icon being created. The selection of symbols are found in the library panel of the .fla that DocumentClass is attached to.So for example, DocumentClass needs an icon with a symbol of a folder on it, and the name of the folder symbol is Folder.What should DocumentClass pass to Icon as an argument? Should it be a string containing the symbol name, or a reference to Folder? If it is a string, how would Icon turn the string "Folder" into the Folder object? Should all of the icon graphics be instantiated in DocumentClass first?[code]
I am trying to send a value from one of my xml nodes (<marker>) by declaring it in a function 'showData' as a variable 'XMLMarker'. If I trace this value (XMLmarker) it returns the right data found in the node <marker> (which is 'myMarker_mc'). However, I need to tell the stage that myMarker_mc is a MovieClip...please see the 'PROBLEM' stated in the code below.
Code:
stop(); var placesXML:XML = <places> <place name= "Yogyakarta">
[code]....
why do you want a variable to hold the value in the node <marker>, when that value is identical for each node, ie. it is always 'myMarker_mc', so why not just directly declare the variable 'xmlMark' as myMarker_mc. The reason is; the value in some of the <marker> nodes will soon be changing to 'myMarker_mc2' - a slightly different movieClip which I may need to call depending upon which place @name is chosen.This is the new output thrown up by the variable XMLmarkers
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.
I'm working on an adventure game and I need to find a way to pass the next MovieClip name to the function that loads it in the main timeline.
ActionScript Code: Bowl_btn.addEventListener(MouseEvent.CLICK, BowlClick); function BowlClick(evt:MouseEvent){ var nextMovie:String = "nameOfNextMovie"; this.parent.parent newMovieLoader (nextMovie); }
This is all good but I can't find a way to use the nextMovie parameter in the function and load a movie from the library. I hope you can understand my explanation..
What I want to be able to do is pass the name of the movie clip (ie mc_01, mc_02...) to the function, and have the function effect that particular movie clip. I had this code that didn't work
I am trying to send a value from one of my xml nodes (<marker>) by declaring it in a function 'showData' as a variable 'XMLMarker'. If I trace this value (XMLmarker) it returns the right data found in the node <marker> (which is 'myMarker_mc'). However, I need to tell the stage that myMarker_mc is a MovieClip. 'PROBLEM' stated in the code below.
i'm pulling my hair over this. i have sucessfully (verified) loaded an xml file and can trace the data i'd like to pass. i am loading the external swf into an empty mc called X. in the external swf i am loading is a mc and in there is a dynamic textfield. i give the content of the xml to the path to the dynamic textfield and nothing happens. trying to pass the variable with: target.text = content;
i listed the variables and objects in the test movie debug option (command+enter) and i can see the dynamic text box variable. then i took copied the path from the output window to my actionscript, replaced _level0 with _root but still to no avail. what am i doing wrong? do i have to publish the swf being loaded in a certain way? why am i able to look at the variables in the debug list variables and objects option, but not in the actionscript?
I wonder if it is possible to pass values from external .swf files to the main projector (.exe) file.? I would also like to know how a button of an external swf file can control the playhead of the main .exe file.
I have this map of tasks. and each map have these houses which when clicked will take you to a certain task(external swf). and when accomplished should have a button to take you back to the map(main swf), and also the button to send a value to the main swf that the task is accomplished.
I have 190 movieclips which display various types of information. When a user clicks on a movieclip, it has to tween larger but also send a string to a method. I'll probably e.currentTarget to use one function which contains a tween and I wondered if there was a quick way to pass string info in a similar way?
So, each movieclip has it's own value which can be passed to a method which will use that value. The only way I can think of so far is to have 190 functions which send the string data to the appropriate place. I'm trying to avoid that if I can.
I have a bunch of nested movieclips. I set a var "foo" on the topmost clip. A child clip wants to know the value of foo: easy enough, i just call parent.foo.But what if I don't know how far down the tree the child resides in? Worse, what if foo changes every so often on new branches?My first thought was to simply add thisvar foo = parent.footo every clip, but this of course requires every clip have that line, or it breaks, and it doens'tus if a new child is inserted, or if a parent "foo" value changes.I was thinking that I could call a recursive function, where a child asks it parent, then its parent's parent, etc, for the value of foo along its particular branch...
function whatIsFoo(obj) { if(obj.parent.foo==undefined) { return whatIsFoo(obj.parent)
I am trying to build a static function that will allow me to do any sort of effect I want, however I would like to give it pass certain parameters but I am not quite sure how to do it. I am basically trying to write my own effects package with easing and all sorts of thing. ActionScript Code: public static function easeMC(targetMC:MovieClip, mcProperty, amount:Number, speed:Number){ targetMC.mcProperty = do the easing code; }
Basically, those are the parameters im trying to pass but I don't know how I would go about assigning the property per se, like if I want the x position or the width to be the one animated. The easiest way I can think of is making mcProperty a string and then doing this: ActionScript Code: switch (mcProperty) case "width": targetMC.width = do the easing code; case "x": targetMC.x = do the easing code;
I loaded a SWF and passed the reference to a Class called Portfolio:
Portfolio.as:
ActionScript Code: package {
[code]....
Now I keep getting one error or another. Right now, it's telling me:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
I tried extending the thing but then I got a: "1203 No default constructor found in base class" error I just want to pass a simple MovieClip reference from one class to another.
PHP Code: myImages_mc = myGallery_mc.createEmptyMovieClip ("myImages_mc", myGallery_mc.getNextHighestDepth()); var myMCL:MovieClipLoader = new MovieClipLoader(); var myPreloader:Object = new Object();myMCL.addListener(myPreloader); for (var i:Number=0; i<myImagesTotal; i++) { [Code] .....
The problem is everytime I click on the image_mc, it traces "undefined". I need to know the value of "image_mc.main" when I click the image_mc. The "main" variable should be the "i", which is the number of loops. On the loop, it traces correctly, but when I put it on the onRelease function, it traces undefined.