Flex :: Access Movieclips From An Imported Swf?
May 5, 2010What are the steps necessary to access movieclips from an imported swf within a Flex application?
View 1 RepliesWhat are the steps necessary to access movieclips from an imported swf within a Flex application?
View 1 RepliesI have imported a swf (not created with Flex, i.e. non-framework) into a Flex application. Once loaded, I would like to access movieclips within that imported swf. [URL].. it seems straightforward; however, their examples are between a Flex app and an imported swf (created with Flex).
Like their example, I'm trying to use the SystemManager to access the imported swf's content; however, I receive the following error:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@58ca241 to mx.managers.SystemManager. Is this error occurring because I'm importing a non-framework swf into a framework swf?
[Code]...
I am using Action Script 3.I have loaded some xml data using an external as file called importxml.as.If I put a trace statement in it to access the content it works perfectly.But how do I access the data from the Flash main timeline or from another as file?I am using the statement �import xmlimport� but if I then write:trace(xmldata.category[1].word[1].text); I get the message;
1120: Access of undefined property xmldata.
If I try this on the main timeline
var myXMLmlimport=new xmlimport();
I get the error message
TypeError: Error #1010: A term is undefined and has no properties.
I have loaded some xml data using an external as file called importxml.as.If I put a trace statement in it to access the content it works perfectly.But how do I access the data from the Flash main timeline or from another as file?I am using the statement import xmlimport but if I then write:trace(xmldata.category[1].word[1].text); I get the message[code]...
View 0 RepliesI'm just now learning the new object oriented way of scripting. It's been a wild ride, but I've finally learned how to keep script off my frames (very hard coming from as2).Here's my problem:
I have a TextField on the stage in my main .fla file named loadPercent.
I'm loading a jpg with preLoad.as and displaying the bytes loaded in loadPercent.
I can access my loadPercent TextField from my MainClass
but I can't access it from preLoad.as
the document class is MainClass.as
Code:
package
{
import flash.display.MovieClip;[code]....
I get three '#1120 access of undefined propery' errors for each time i try to access loadPercent.
a few basic questions: 1. all my files are in a folder in my documents, not in the flash directory, is this bad? I've seen people using com.whatever etc.
2. my main .fla file does not share the same name as my MainClass.as (it's not named MainClass.fla) Is that a problem?
I'm assuming these are inconsequential because my code seems to work up to a certain point.
I'm using a flex component that use a to load a .swf file.
The loaded .swf
- is passed to me as is and I can't edit
- it has some as3 functions in it
Is it possible in the "parent" application (the one with ) to override functions included in the "child" swf (the imported one)?
I'm loading in a flex application a .swf via <mx:Image> (that is a subclass of SWFLoader). Is it possible to retrieve a list of all the public variables and functions inside the loaded .swf?
View 1 RepliesI have a good bit of knowledge regarding OOP underneath my belt, and working with AS3 has so far been pretty awesome. That being said I am having a little bit of trouble working with Inverse Kinematic structures and AS3.Here is my predicament:
So what I would like to have is a number of tentacles on the stage that reach out for the mouse cursor. Through all the tutorials and whatnot that I have sorted through thus far I have gotten it working, however I have only gotten it working when the armatures are placed in the main scene. I have made a tentacle movie clip that has an armature within it and placed a number of those within the scene. I can modify the positions of the endJoints of those tentacle movie clips by gaining reference to the respective armatures using the following [code]...
I'm just wondering if it is possible to use a string values as a way to use the addEventlistener function.[code]...
View 5 RepliesHow do you access a nested movieclip? how do you access stuff in mc2_mc or mc2_mc itself from within mc1_mc or maintimeline?
View 2 RepliesI'm new to actionscript 3 and I'm trying to get a few simple things going, such as setting variables in other movieclips... So let's say I have an "apple" movieclip on the root/stage, and I want to access other variables on the root, or in other movieclips. How would I do that? In actionscript 2, I would use something like
_root.thisVar = 1;
_parent.thisVar = 1;
and with other movie clips I would use
[code].....
TypeError: Error #1034: Type Coercion failed: cannot convert "brick1" to flash.display.MovieClip.so I tried tracing e.target.name and it gave me the correct instance names for each movieclip, however when I try moving the object with then it gives me the above error.
ActionScript Code:
import flash.events.Event;
import flash.display.MovieClip;[code]........
I have a Flex project that is the application master for my site. It loads a swf I built in Flash which has a runtime bones animation using a Loader. The runtime bones work if they are loaded without Flex.
Is there a way to make bones work if they are loaded by Flex?
I've been having this really annoying thing happen the past few days, that has happened before but not as frequently. I create a project in Flash Builder, import some classes, and then on occasion it keeps erasing those classes. So then I get errors in a lot of my datatypes, have to go back through my document and retype the datatype so that it reimports the class.
I know flash builder can be a bit buggy at times
I think I must be missing a step here; I have different data being pulled from an array created from xml depending on a variable (_currentTrackNum).. and the data changes if I set a different initial value for it; but if I change the variable once the program is initialized, none of the data changes even though I rerun the call with the changed variable.[code]
View 1 RepliesI imported a project from ClearCase into Eclipse and it's not associated with ClearCase; meaning no check in/check out. The only thing I get under 'Team' is 'apply patch' or 'share project'.Other projects I import into Eclipse are automatically linked to ClearCase, but not this one.I even created a separate workspace for this view and still some projects will be linked and others not. It's not even dependent upon project; it's arbitrary.
View 1 RepliesProcess terminated unexpectedly.
Initial content not found
Launch command details: "C:Program FilesAdobeAdobe Flash Builder 4sdks4.0.0inadl.exe" -runtime "C:Program FilesAdobeAdobe Flash Builder 4sdks4.0.0
untimesairwin" "C:UsersacerAdobe Flash Builder 4Dental Clinic_2Main-app.xml" "C:UsersacerAdobe Flash Builder 4Dental Clinic_2"
I get this error when I try to run the program...this is my first time to import other projects.. I dont have this problem with my own program this just appeared from the project I imported...
I'm importing/loading external swfs into a program, but when I get or set the width/height- it using the entire, unmasked image, and not what is visible.That makes sense, but is there anyway to either discard the masked content(crop), or only get/set the value of size of the visible image?It could be any swf, and I can't control the swf's coming in.I am importing them using flex's mx.controls.image, but have also tried a normal as3 loader with the same problem.
View 2 RepliesI have the following code that loads MovieClips to the stage:
[Code]......
Let's say I have 18 MovieClips and on the 18th MovieClip I have a button that I need to access. How would I do that? The following doesn't work:
Actionscript Code:
sp.bm.Page18._homeBtn.addEventListener("mouseUp", goHome);
Gives error: Error #1010: A term is undefined and has no properties.
I have a flash with animations playing one after another. Say animation 1 finishes and i have a button which says Play Next named as playNext when i add the below code playNext.addEventListener(MouseEvent.CLICK,functio n(){gotoAndPlay("indexFade");}); on the last frame or the first frame ater stop it says ReferenceError: Error #1065: Variable btnChallange is not defined. at FB_index_fla::MainTimeline/FB_index_fla::frame1()
View 5 RepliesI'm trying to simply access anything inside this loaded SWF and all I get is 'null'.
I have code in the parent SWF that needs to tell the child SWF movieclip what to do but nothing works. This was a piee of cake in AS2 and I can't seem to get anything to crossover in AS3.
Here's my code:
import com.greensock.TweenMax;
import flash.display.MovieClip;
var myLoader:Loader = new Loader();
[Code]......
panel2 traces null and all the clips loaded within pull up undefined property errors.
Basically, I have some functions in my as file. Some of them play with a mc instance. The instance is not available when calling the function that uses it as callback.
AS
function B(){
ExternalInterface.call('console.log','ok')//OK!!!
} //italy is a MovieClip on the Main timeline
function A(){ B();
ExternalInterface.call('console.log',italy)//Error!
} ExternalInterface.addCallback('test',A);
JS
$('flash').test();//flash is my html swf object
The error I get trying to reference italy from A (only) whem called from javascript:
Uncaught exception: Error in Actionscript.
Basically, the italy movieclip is available through the AS functions. But it isn't available if I call an AS function from javascript. As you can see though, I see B from A. It's only Italy that I can't see. why?
So I am using this code to embed my .swf file. I am creating classes for each asset in my library.
[Embed('assets/assets.swf', symbol='game.menu.levels')]
public static const LEVELS_MENU:Class;
It works just fine but how can I access a child element multiple depths down?
[Code]...
I'm creating a card game and I need to use graphics from the library. All the movieclips have their linkage setup. How do I access the library movieclips from a class?
View 2 RepliesI am new to actionscript. I have a movie clip (mc)in my library. The Movieclip has a dynamic text whose instance is "dynamic_txt". I need to create copies of movieclip and each dynamic_txt within that mc, want to assign a value.
for (i=1 , i< 20, i++) {
mymc = mc add i;
duplicatemovieclip(mc, mymc,10);
_level0.mymc.dynamic_txt.text = i
}
However, "_level0.mymc.dynamic_txt.text = i " is giving me compilation error. Will it be
_level0.['mymc'].dynamic_txt.text = i
or
_level0.'mymc'.dynamic_txt.text = i
or anything else. I have tried few combination and either its compilation error or not working as required.
Say we have a set of similar MovieClips in the library that all use the same base class, such as Car(). Each of these clips in the library contain nested clips, such as windows. Now, different cars can have a different number of windows (an SUV is larger than a smart car), and thus a different number of nested MovieClips. How would one create a list of all the nested MovieClips in a parent clip dynamically? In AS2, for...in was sufficient for this, like so:
Code:
for(var i in this) {
trace(i); //If called at the beginning of a constructor, this would output only the nested
[code].....
I am trying to understand what is going on in a SWC that I am importing from Flash CS4 into Flex Builder 3. Specifically I am using a SWC supplied by a Designer as the animation for a custom preloader (a subclassed DownloadProgressBar).The issue I am trying to understand is, once the FlexEvent.INIT_COMPLETE is fired, I cleanup by removing the swc by running this [code]though even after I have removed this (which is successful, as I have checked by comparing this.numChildren before and after the call) the key framed animation still continues to run (not visibly). This has been detected by the Designer placing a trace in the time line of the animation (in Flash). Can anyone tell me why is it, that even after I have removed the animation from the subclassed DownloadProgressBar, it still keeps running ? Also, is it standard practice when importing SWCs to manage the cleanup of resources from the Flash side of things (much like releasing memory in obj-c). I find it counter intuitive that removing the child from the Flex side does not stop the animation.
View 1 RepliesI wanted to import an older FB project into the flash builder on my new pc, but I only have the filestructure. So I used 'import>existing projects into workspace'.The files seem to be intact still, but the project now gives me an error regarding an swc in the bin folder:
'unable to open 'something'in'something'.swc
As you can see on the image, ive created a 1-frame-timeline which has a movieclip called Main_mc (instancename is myMain_mc). Main_mc has 3 movieclips, one is called Intro_mc. These 3 movieclips are not present on the whole timeline. F.e. Intro_mc is just present at frame 2-19. All of these movieclips has instance-names, f.e. myIntro_mc.
Intro_mc is again a movieclip which has more movieclips,which are present on certain frames, f.e. one movieclip is just present at frame 12-20. All movieclips has instance-names. (I code into a seprated actionscript-file.
Problem is that i cant refer to moviceclips which are nested in the movieclip "myMain_mc" which is on the main timeline. I can just refer to movieclips which are on the main timeline (like myMain_mc), i cant go deeper.
I have an application created in Flash Builder 4 that loads SWFs of flash files and I want to access movie clips within these flash files. I can access top level movie clips using:
var assetName:String = "example_mc";
this._graphics[assetName].addChild(this._customText);
However when I want to access nested movie clips I am unsuccessful, I have tried:
var assetName:String = "example_mc";
var assetName2:String = "example2_mc";
this._graphics[assetName][assetName2].addChild(this._customText);
and I have tried:
MovieClip(DisplayObjectContainer(this._graphics.getChildByName(assetName)).getChildByName(assetName2)).addChild(this._customText);
In addition I tried variants of the square brackets and "getChildByName" but still no success.All moviclips are instantiated in frame 1 of the Flash files?
Edit :I forgot to tweak my error handling so an error would be shown, plus all my tests where not showing text, late afternoon on a Mon is not my brightest hour! ;) I worked it out in the end, the solution was either (as above):
MovieClip(DisplayObjectContainer(this._graphics.getChildByName(assetName)).getChildByName(assetName2)).addChild(this._customText);
Or:
MovieClip(DisplayObjectContainer(this._graphics.getChildByName(assetName))[assetName2]).addChild(this._customText);