Re: [Flashcoders] How do you tell if an Object is dynamic?

2008-01-07 Thread Jamie S
I realized the moment i encountered the problem that dynamically
adding a property to an argument was bad form so I went another
direction with it (thanks to all who suggested creating a subclass),
but I asked the question because I thought it was an interesting
problem.

The original function was used to add a unique token to an Object
containing a set of arbitrary parameters. ( here's a simplified
version )

function (theObject:Object) {

 theObject.__token = Math.random();

 sendVarsToServer(theObject);

}

In the above function, you get an error if a non-dynamic subclass of
Object is passed in.

I think the suggestion to use flash.utils.describeType() was probably
what I was looking for.

Jamie

On Jan 7, 2008 1:59 AM, Sunil Jolly <[EMAIL PROTECTED]> wrote:
> Have you got an example Jamie?
>
> Sunil
>
>
> -Original Message-
> From: Jamie S [mailto:[EMAIL PROTECTED]
> Sent: 05 January 2008 01:51
> To: Flash Coders List
> Subject: [Flashcoders] How do you tell if an Object is dynamic?
>
> I ran into a particular situation where i had a function that took an
> Object as a parameter. I needed that Object to be an actual Object
> i.e. dynamic because the function was going to add properties to it.
> But since everything in ActionScript is an Object I had trouble
> enforcing this.
>
> Is there a way to check to see if an Object is dynamic? Or is there a
> way to enforce something as an Object rather than a subclass of in
> Object (which is everthing else)?
>
> Jamie
>
>
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] How do you tell if an Object is dynamic?

2008-01-07 Thread Sunil Jolly
Have you got an example Jamie?

Sunil

-Original Message-
From: Jamie S [mailto:[EMAIL PROTECTED] 
Sent: 05 January 2008 01:51
To: Flash Coders List
Subject: [Flashcoders] How do you tell if an Object is dynamic?

I ran into a particular situation where i had a function that took an
Object as a parameter. I needed that Object to be an actual Object
i.e. dynamic because the function was going to add properties to it.
But since everything in ActionScript is an Object I had trouble
enforcing this.

Is there a way to check to see if an Object is dynamic? Or is there a
way to enforce something as an Object rather than a subclass of in
Object (which is everthing else)?

Jamie


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How do you tell if an Object is dynamic?

2008-01-05 Thread Hans Wichman
Hi,
on a sidenote, a dictionary object from object to object can be created for
as2 very easily as well, the problem lies with the absence of weak
referencing. Even then it is stll very usefull in as2 as well.

greetz
JC

On Jan 5, 2008 8:41 AM, T. Michael Keesey <[EMAIL PROTECTED]> wrote:

> If you're using AS3, you might consider using a Dictionary object instead.
>
> If not, then you could make your own dynamic subclass of Object and
> use that (although that might break other code -- I'm not sure what
> your situation is).
>
> On Jan 4, 2008 5:51 PM, Jamie S <[EMAIL PROTECTED]> wrote:
>  > I ran into a particular situation where i had a function that took an
> > Object as a parameter. I needed that Object to be an actual Object
> > i.e. dynamic because the function was going to add properties to it.
> > But since everything in ActionScript is an Object I had trouble
> > enforcing this.
> >
> > Is there a way to check to see if an Object is dynamic? Or is there a
> > way to enforce something as an Object rather than a subclass of in
> > Object (which is everthing else)?
> >
> > Jamie
> > ___
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
>
>
> --
> T. Michael Keesey
> Director of Technology
> Exopolis, Inc.
> 2894 Rowena Avenue Ste. B
> Los Angeles, California 90039
> http://exopolis.com/
> --
> http://3lbmonkeybrain.blogspot.com/
>  ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] How do you tell if an Object is dynamic?

2008-01-05 Thread Merrill, Jason
>>I ran into a particular situation where i had a function that 
>>took an Object as a parameter. I needed that Object to be an 
>>actual Object i.e. dynamic because the function was going to 
>>add properties to it.
>>But since everything in ActionScript is an Object I had 
>>trouble enforcing this.
>>
>>Is there a way to check to see if an Object is dynamic? Or is 
>>there a way to enforce something as an Object rather than a 
>>subclass of in Object (which is everthing else)?

Why not have the object required to be an instance of a custom class
instead of a generic object?  You typecast the argument to be your
custom class.  i.e.

import MyCustomClass;

class myClass
{
private function myFunction (myCustomClass:MyCustomClass):void
{
}
}

Would that do what you want?


Jason Merrill
Bank of America  
GT&O L&LD Solutions Design & Development 
eTools & Multimedia 

Bank of America Flash Platform Developer Community


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How do you tell if an Object is dynamic?

2008-01-04 Thread T. Michael Keesey
If you're using AS3, you might consider using a Dictionary object instead.

If not, then you could make your own dynamic subclass of Object and
use that (although that might break other code -- I'm not sure what
your situation is).

On Jan 4, 2008 5:51 PM, Jamie S <[EMAIL PROTECTED]> wrote:
> I ran into a particular situation where i had a function that took an
> Object as a parameter. I needed that Object to be an actual Object
> i.e. dynamic because the function was going to add properties to it.
> But since everything in ActionScript is an Object I had trouble
> enforcing this.
>
> Is there a way to check to see if an Object is dynamic? Or is there a
> way to enforce something as an Object rather than a subclass of in
> Object (which is everthing else)?
>
> Jamie
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
T. Michael Keesey
Director of Technology
Exopolis, Inc.
2894 Rowena Avenue Ste. B
Los Angeles, California 90039
http://exopolis.com/
--
http://3lbmonkeybrain.blogspot.com/
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How do you tell if an Object is dynamic?

2008-01-04 Thread Glen Pike
With AS2, you can use typeof and instanceof operators, but typeof is 
only limited to a few classes so you can only test for MovieClip, 
Button, String, Function & a few others.


You may need to look at stricter typing for your dynamic "objects" and 
having fixed properties for these rather than just creating them all as 
Object - try creating a class for these "objects" instead (you can just 
use public variables/properties and manipulate these directly without 
resorting to methods, etc).  Then the compiler will help you out if you 
type the argument to the function to this class - you can't really have 
the loose type checking of AS1 with stricter OOP of AS2 / AS3 - I may be 
wrong though.


HTH

Glen

Jamie S wrote:

I ran into a particular situation where i had a function that took an
Object as a parameter. I needed that Object to be an actual Object
i.e. dynamic because the function was going to add properties to it.
But since everything in ActionScript is an Object I had trouble
enforcing this.

Is there a way to check to see if an Object is dynamic? Or is there a
way to enforce something as an Object rather than a subclass of in
Object (which is everthing else)?

Jamie
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


  


--

Glen Pike
01736 759321
www.glenpike.co.uk 
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How do you tell if an Object is dynamic?

2008-01-04 Thread Jason M Horwitz
Its pretty easy with AS3's reflection API; take a look at
flash.utils.describeType.

Jason
// Sekati

On Jan 4, 2008 8:51 PM, Jamie S <[EMAIL PROTECTED]> wrote:

> I ran into a particular situation where i had a function that took an
> Object as a parameter. I needed that Object to be an actual Object
> i.e. dynamic because the function was going to add properties to it.
> But since everything in ActionScript is an Object I had trouble
> enforcing this.
>
> Is there a way to check to see if an Object is dynamic? Or is there a
> way to enforce something as an Object rather than a subclass of in
> Object (which is everthing else)?
>
> Jamie
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
:::
: jason m horwitz // sekati llc // nyc + mke
: [EMAIL PROTECTED] | [EMAIL PROTECTED]
: http://sekati.com | http://cv.sekati.com
: +1.414.455.4406 | +1.646.662.3331
: aim/skype: n0kati
:::
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] How do you tell if an Object is dynamic?

2008-01-04 Thread Jamie S
I ran into a particular situation where i had a function that took an
Object as a parameter. I needed that Object to be an actual Object
i.e. dynamic because the function was going to add properties to it.
But since everything in ActionScript is an Object I had trouble
enforcing this.

Is there a way to check to see if an Object is dynamic? Or is there a
way to enforce something as an Object rather than a subclass of in
Object (which is everthing else)?

Jamie
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders