[Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Fahim Akhter
Hi, I have a swf which I load using a customized swf loader. The problem I'm facing is after I load the swf, I want to tell one of its symbol to do an action. But this does not seem to work . Any word on that? ___ Flashcoders mailing list

RE: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread David Hunter
hi, are you programming in AS2 or AS3? From: akhter.fa...@gmail.com Date: Tue, 9 Mar 2010 13:59:35 +0500 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Accessing Symbol inside of loaded SWF Hi, I have a swf which I load using a customized swf loader. The problem I'm

Re: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Geografiek
No you can't reference something that is not ther yet. You need to add an eventlistener to imageloader to listen for the loading to complete. Inside that event listener you can call imageLoader.content.testMovie.gotoAndStop(2) HTH Willem van den Goorbergh ps please post your questions to 1

Re: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Fahim Akhter
Willem,. Here is the full scenario. I have a swfLoading class which loads SWF for me. Once the swf is loaded say a ball. I want to click on different colors and change the color of the stripes on the ball. Now, with what you said I can access things once they are loaded. The load complete

Re: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Fahim Akhter
I'm using AS3 here is a little more detail. I'm loading an swf say test.swf which gets loaded in imageLoader , so I can get its content by : imageLoader.content So if I wanted one of the movieClips inside it I would do this : imageLoader.content.testMovie.gotoAndStop(2); But when I do

Re: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Fahim Akhter
Basically the myLoadedSwf is a child of a class called LoadingClass , if I access myLoadedSwf.myBall.myStripeToReColor inside that class it works. But when I make an instance of the class and myLoadedSwf is a child in that class. I'm unable to reference the child var testLoader:LoadingClass =

[Flashcoders] Manipulating and Removing loaded swf

2010-03-09 Thread Lehr, Theodore
Given the code below that I found on the web - I have 2 questions: 1) How would I manipulate the swf (i.e. change it's placement on the stage) 2) How would I remove it? TIA Ted import flash.net.URLRequest; import flash.display.Loader; import flash.events.Event; import

Re: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Fahim Akhter
Finally got it solved. Created new movieClip referenced it to the exact object I needed and made it public in the loader class. Created an event listener to listen for the end of Complete Load and dispatch another event which is caught by the outside class which changes the color :) Thanks a lot

Re: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Glen Pike
You would probably want to either set a flag, or store a variable in your class / outside your event handler function that is null before the content is loaded. In other functions that manipulate that clip, you should test that the variable is not null before manipulating it. Alternatively,

Re: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Fahim Akhter
Another correction : basically its not imageLoader.content.testMovie.gotoAndStop(2); but I want to transform the color of testMovie which is an movieClip inside the loaded SWF On Tue, Mar 9, 2010 at 4:12 PM, Fahim Akhter akhter.fa...@gmail.com wrote: I'm using AS3 here is a little more detail.

Re: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Geografiek
Oké, now I understand, In that case you have to make sure that the user can click only when the ball is loaded. I guess you have an eventListener somewhere that listens for users to click. When you trace for the ball in that eventlistener, do you get the expected reference to it? Maybe your

[Flashcoders] Synchronous code?

2010-03-09 Thread Glen Pike
Hi, More of a strange encounter that I would like to share / get some input on than something I need to fix this one... I have recently encountered an issue where I am getting null for the stage property of a Sprite subclass in it's event handler for ADDED_TO_STAGE. I have managed to

Re: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Fahim Akhter
testVar.ball.myStripeToReColor.transform can be written as testVar.someMovieClip.myStripeToReColor.transform On Tue, Mar 9, 2010 at 7:11 PM, Geografiek geograf...@geografiek.nl wrote: Fahim, I think testVar already references 'ball' so testVar.ball in your last line is wrong. HTH Willem

Re: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Geografiek
So, what's your problem? On 9-mrt-2010, at 15:33, Fahim Akhter wrote: testVar.ball.myStripeToReColor.transform can be written as testVar.someMovieClip.myStripeToReColor.transform On Tue, Mar 9, 2010 at 7:11 PM, Geografiek geograf...@geografiek.nl wrote: Fahim, I think testVar already

Re: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Fahim Akhter
I posted it on flexcoders accidently. Then had to update the question there too. I apologize for that. Hmm what if I do not want to reference it from inside that event Listener but a another movie clip who would be later its parent? On Tue, Mar 9, 2010 at 4:24 PM, Geografiek

Re: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Geografiek
Hi Fahim, Can be anything. To give you something to proceed we really need more information. What are you doing exactly? (what is the code you use to tell the symbol to do an action) What would you expect to happen? What is actually happening (error codes etc.) Willem van den Goorbergh On

Re: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Geografiek
Hi Fahim, I'm afraid I don't understand your question. What are you trying to accomplish? afaik this is not a matter of 'wanting to'. You just have to wait to address something until it is loaded. Willem On 9-mrt-2010, at 12:51, Fahim Akhter wrote: I posted it on flexcoders accidently.

Re: [Flashcoders] Accessing Symbol inside of loaded SWF

2010-03-09 Thread Geografiek
Fahim, I think testVar already references 'ball' so testVar.ball in your last line is wrong. HTH Willem van den Goorbergh On 9-mrt-2010, at 14:36, Fahim Akhter wrote: Basically the myLoadedSwf is a child of a class called LoadingClass , if I access myLoadedSwf.myBall.myStripeToReColor inside

Re: [Flashcoders] Manipulating and Removing loaded swf

2010-03-09 Thread kennethkawam...@gmail.com
Create a var outside of your functions to reference your loaded SWF: var mc:MovieClip; So that you can assign it to your SWF when loaded: mc = loadEvent.target.content as MovieClip; Then you can interact with it: with(mc){ x = 100; y = 200; } removeChild(mc); etc. -- Kenneth

Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-09 Thread John Singleton
From: Glen Pike postmas...@glenpike.co.uk To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Mon, March 8, 2010 3:04:47 PM Subject: Re: [Flashcoders] Re: swf doesn't work the same online var nNavs:Array = new Array(); for(var i:int = 0; i numLinks;i++) { var nav:Sprite =

[Flashcoders] RE: Manipulating and Removing loaded swf

2010-03-09 Thread Mattheis, Erik (MIN - WSW)
You need to declare a variable in your class and assign the movieclip to it - outside a function, ie var myMC:MovieClip; then you could change addChild(loadEvent.currentTarget.content); to myMC = loadEvent.currentTarget.content; addChild(myMC); and manipulate it myMC.x += 10; remove it

Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-09 Thread Glen Pike
Hi, You need to make your nav function return the sprite it creates, so change the signature to: function nav(nname:String, nurl:String, myX:int, bgcolor:uint):Sprite and return nsprite at the bottom. Glen John Singleton wrote: From: Glen Pike postmas...@glenpike.co.uk To:

Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-09 Thread Valentin Schmidt
John Singleton wrote: From: Glen Pike postmas...@glenpike.co.uk To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Mon, March 8, 2010 3:04:47 PM Subject: Re: [Flashcoders] Re: swf doesn't work the same online var nNavs:Array = new Array(); for(var i:int = 0; i numLinks;i++) {

Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-09 Thread John Singleton
From: Glen Pike g...@engineeredarts.co.uk To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Tue, March 9, 2010 12:22:03 PM Subject: Re: [Flashcoders] Re: swf doesn't work the same online Hi, You need to make your nav function return the sprite it creates, so change the signature

Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-09 Thread Glen Pike
Sorry, my typo / error. You need to change bgcolor to backgroundColor in the event handler functions (bgcolor is not a property of TextField), e.g. TextField(nsprite.mynav).backgroundColor = 0x... John Singleton wrote: From: Glen Pike g...@engineeredarts.co.uk To: Flash Coders List

Re: [Flashcoders] Synchronous code?

2010-03-09 Thread jonathan howe
Hi, Glen, Sounds pretty wacky to me. I'm going to ask a dumb question just to be sure... In the code snippet, the event handler is inside the Sprite subclass itself? In other words, I wanted to make sure that your reference to stage is indeed the property of the event source, i.e. would this be

Re: [Flashcoders] Synchronous code?

2010-03-09 Thread Glen Pike
Hi, The added to stage handler is inside the Sprite subclass: public function GenericButton(attrs:* = null){ this.attrs = attrs; addEventListener(Event.ADDED_TO_STAGE, _addedToStageHandler, false, 0, true); addEventListener(Event.REMOVED_FROM_STAGE,

Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-09 Thread John Singleton
From: Glen Pike g...@engineeredarts.co.uk To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Tue, March 9, 2010 1:26:14 PM Subject: Re: [Flashcoders] Re: swf doesn't work the same online Sorry, my typo / error. You need to change bgcolor to backgroundColor in the event handler

Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-09 Thread Valentin Schmidt
hi john, John Singleton wrote: Sorry, my typo / error. You need to change bgcolor to backgroundColor in the event handler functions (bgcolor is not a property of TextField), e.g. TextField(nsprite.mynav).backgroundColor = 0x... No, I caught that and made the appropriate substitution.

[Flashcoders] Preventing duplicate values in string constants (PureMVC)

2010-03-09 Thread Christoffer Enedahl
I've published a little tip about preventing duplicate values in string constants Read about it here: http://blog.enedahl.com/?p=18 Excerpt: PureMVC uses strings to map notifications. This could lead to a number of string constants in a class. When creating new notifications I usually

[Flashcoders] ternary operator with function.call?

2010-03-09 Thread Mendelsohn, Michael
Hi list... Can something like this be done? Just curious... - MM function traceNum(i:int):void{ trace(i); } function traceString(a:String):void{ trace(a); } var s:String = hi; (s!=)?traceString.call(yes):traceNum.call(44); ___

Re: [Flashcoders] ternary operator with function.call?

2010-03-09 Thread Dave Watts
Can something like this be done?  Just curious... function traceNum(i:int):void{        trace(i); } function traceString(a:String):void{        trace(a); } var s:String = hi; (s!=)?traceString.call(yes):traceNum.call(44); Sure. Function calls are valid expressions. Dave Watts, CTO,

Re: [Flashcoders] ternary operator with function.call?

2010-03-09 Thread Piers Cowburn
A lot of people don't like it, stylistically, but it will certainly work. Generally I don't use ternary operators for anything other than assignments. Piers On 9 Mar 2010, at 20:23, Mendelsohn, Michael wrote: Hi list... Can something like this be done? Just curious... - MM

[Flashcoders] Tweening symbols issue!

2010-03-09 Thread Fahim Akhter
Hi, If I create a new symbol apply a classic to it works fine and no Tween symbol is created which is exactly what I want. At the same time I have a movieclip with a couple of more movieClips in it on frame one. When I create a motion tween (classic) for this symbol. This ends up in a new