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
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
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
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
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
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
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
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
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
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
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.
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
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
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:
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
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
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
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
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
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
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
{
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
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
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
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
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
26 matches
Mail list logo