[Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Jim Andrews
i want to write a method x which takes an argument y. i cannot anticipate what type the argument is going to be until run-time. it might be a number or a string or an array or who knows what? but i am not sure how to do this in actionscript because it is strongly typed. normally what is done

RE: [Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Cor
public function x(y:* = null):void { } -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Jim Andrews Sent: maandag 7 juni 2010 12:41 To: Flash Coders List Subject: [Flashcoders] problem with strongly typed

Re: [Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Hans Wichman
public function x(y:Object):void { } or public function x(y:*):void { } hth jc On Mon, Jun 7, 2010 at 12:40 PM, Jim Andrews j...@vispo.com wrote: i want to write a method x which takes an argument y. i cannot anticipate what type the argument is going to be until run-time. it might be a

[Flashcoders] Passing Var value to loaded swf

2010-06-07 Thread Lehr, Theodore
I found this code: in the parent swf gameLoader.contentLoaderInfo.addEventListener(Event.INIT, onInit); function onInit(e:Event) { MovieClip(gameLoader.content).userId = 100; } In the loaded swf public class Game extends MovieClip { public var userId:int = 0; function

Re: [Flashcoders] RE: Passing Var value to loaded swf

2010-06-07 Thread Gerry Beauregard
I don't have a whole lot of experience with the Loader class, but I suspect that rather than calling addChild() immediately after calling load(), you'd need to listen for a load complete event (Event.COMPLETE), and call addChild() in the handler for that event. -Gerry

Re: [Flashcoders] RE: Passing Var value to loaded swf

2010-06-07 Thread Eric E. Dolecki
When in doubt, look at timing. I think Gerry is on to something :) On Mon, Jun 7, 2010 at 10:03 AM, Gerry Beauregard gerry.beaureg...@sonoport.com wrote: I don't have a whole lot of experience with the Loader class, but I suspect that rather than calling addChild() immediately after calling

Re: [Flashcoders] RE: Passing Var value to loaded swf

2010-06-07 Thread Henrik Andersson
Eric E. Dolecki wrote: When in doubt, look at timing. I think Gerry is on to something :) Yeah, but he is looking in the wrong direction. It is the loaded movie that tries to use the parent when it doesn't have any yet. ___ Flashcoders mailing list

Re: [Flashcoders] RE: Passing Var value to loaded swf

2010-06-07 Thread Eric E. Dolecki
One could have the parent fire an init method to a loaded SWF. Then the loaded movie would know that the parent was present. I believe. On Mon, Jun 7, 2010 at 10:28 AM, Henrik Andersson he...@henke37.cjb.netwrote: Eric E. Dolecki wrote: When in doubt, look at timing. I think Gerry is on to

[Flashcoders] RE: Passing Var value to loaded swf

2010-06-07 Thread Lehr, Theodore
I am finding this solution everywhere: Calling Parent Variables and Functions from a Loaded SWFhttp://mattmaxwellas3.blogspot.com/2008/10/accessing-variables-and-functions-from.html Let's say I have one SWF (child.swf) that I want to load into another SWF (parent.swf), then I want to call a

Re: [Flashcoders] RE: Passing Var value to loaded swf

2010-06-07 Thread Henrik Andersson
Eric E. Dolecki wrote: One could have the parent fire an init method to a loaded SWF. Then the loaded movie would know that the parent was present. I believe. Or you could just wait for the ADDED event. ___ Flashcoders mailing list

Re: [Flashcoders] RE: Passing Var value to loaded swf

2010-06-07 Thread Eric E. Dolecki
yup On Mon, Jun 7, 2010 at 10:47 AM, Henrik Andersson he...@henke37.cjb.netwrote: Eric E. Dolecki wrote: One could have the parent fire an init method to a loaded SWF. Then the loaded movie would know that the parent was present. I believe. Or you could just wait for the ADDED event.

Re: [Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Steven Sacks
Architecturally speaking, that's a bad idea. There's probably a strongly typed solution to what you're doing. Can you provide detail about what you need to accomplish so we can help you figure out a better solution? On 6/7/2010 3:40 AM, Jim Andrews wrote: i want to write a method x which

Re: [Flashcoders] Passing Var value to loaded swf

2010-06-07 Thread Steven Sacks
Loader is a DisplayObject. You can add Loader to the stage before telling it to load. You don't have to wait to addChild() the content of the Loader after it loads. You cannot dispatch bubbled events from your loaded swf through the Loader that loaded it. Keep that in mind. Doing

Re: [Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Patrick Matte
public function x(y:Object):void { } Or this public function x(y:*):void { } From: Steven Sacks flash...@stevensacks.net Reply-To: Flash Coders List flashcoders@chattyfig.figleaf.com Date: Mon, 07 Jun 2010 11:38:07 -0700 To: Flash Coders List flashcoders@chattyfig.figleaf.com Subject:

Re: [Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Kerry Thompson
Patrick Matte wrote: public function x(y:Object):void { } Or this public function x(y:*):void { } Or, you can simply turn strict mode off. I tend to agree with Steven Sacks, though. There's a really good reason for strong typing--mainly, it's easier to find bugs at compile time than

RE: [Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Merrill, Jason
Or, you can simply turn strict mode off. I tend to agree with Steven Sacks, though. There's a really good reason for strong typing--mainly, it's easier to find bugs at compile time than at Yep. IMO, there should never be a reason to turn strict typing off, it's like saying, Don't tell me about

Re: [Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Hans Wichman
or maybe he is just writing a custom logger and wants to be able to pass any type of object ;) On Mon, Jun 7, 2010 at 9:44 PM, Merrill, Jason jason.merr...@bankofamerica.com wrote: Or, you can simply turn strict mode off. I tend to agree with Steven Sacks, though. There's a really good

Re: [Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Hans Wichman
I send the same reply 8 hours ago, are my messages not coming through?:) On Mon, Jun 7, 2010 at 9:05 PM, Patrick Matte patrick.ma...@tbwachiat.comwrote: public function x(y:Object):void { } Or this public function x(y:*):void { } From: Steven Sacks flash...@stevensacks.net

Re: [Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Jim Andrews
Architecturally speaking, that's a bad idea. There's probably a strongly typed solution to what you're doing. Can you provide detail about what you need to accomplish so we can help you figure out a better solution? i expect public function x(y:*):void { } will do the job. the public

Re: [Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Patrick Matte
Ah, didn't read the thread from the beginning. You could also create an interface. For example public function x(y:IEventDispatcher):void { } From: Hans Wichman j.c.wich...@objectpainters.com Reply-To: Flash Coders List flashcoders@chattyfig.figleaf.com Date: Mon, 7 Jun 2010 21:45:50 +0200

Re: [Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Steven Sacks
Right so what you're essentially talking about is a Model, and the SharedObject is acting as a Service. public class Model extends EventDispatcher { private var so:SharedObject; public function Model() { super(); init(); } private function init():void {

Re: [Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Juan Pablo Califano
I agree with you, but I'add for the sake of completeness that, sometimes, relaxing the rules a bit becomes a necessary evil, like for instance, when doing a cast. When you do this: // bar is typed as ISomeInterface somewhere else var foo:SomeConcreteClass = bar as SomeConcreteClass; // or

Re: [Flashcoders] If a URL starts with “http: //” will clip always be loaded into REM OTE sandbox?

2010-06-07 Thread Anthony Pace
Oops... Geeze...sorry... realized you were talking about swf files and not images...posted this after working for 43 hours straight. For images it is just using javascript and canvas to grab Pixel info from your image, and then send it to flash using ExternalInterface. In your case, with an

Re: [Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Steven Sacks
With due deference, what you just said I disagree with. The scenario you described is not a necessary evil, it's a hack. The only situation where that isn't a hack is if your class extends a native type such as Sprite, but there's no ISprite. That problem is either solved by adding the Sprite

Re: [Flashcoders] problem with strongly typed actionscript

2010-06-07 Thread Juan Pablo Califano
Much obliged for your deference. We would have to agree to disagree then, since I think I agree with you in general terms, but you seem to disagree on this alleged agreement. You say except for one specific case, the scenario I described is a hack. Call it whatever you like. I might even agree

Re: [Flashcoders] Passing Var value to loaded swf

2010-06-07 Thread Juan Pablo Califano
Maybe I should rethink that metaphor... Yes, please. Although in this case, wouldn't grandpa and granny be the ones having sex? Not sure if that makes the metaphor more or less disturbing, though. Cheers Juan Pablo Califano 2010/6/7 Steven Sacks flash...@stevensacks.net Loader is a