http://www.mustardlab.com/developer/flash/jscommunication/

[EMAIL PROTECTED] wrote:
Take a look at this.
I did not encounter any problems with browsers using the following:

http://www.mustardlab.com/developer/flash/jscommunication/

Happy newyear,

Jiri



Send Flashcoders mailing list submissions to
        flashcoders@chattyfig.figleaf.com

To subscribe or unsubscribe via the World Wide Web, visit
        http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Flashcoders digest..."


Today's Topics:

   1. Re: JavaScript to Flash Communication Compatability
      (Jeff Mastropietro)
   2. Re: Undefine a Component (Charles Parcell)
   3. Re: JavaScript to Flash Communication Compatability
      (Nathan Derksen)
   4. Re: Singleton as associative array - yucky icky? (g.wygonik)
   5. Re: Remote Debugging + Flash Remoting = Frozen Browser.   FP8
      Bug? (Judah Frangipane)
   6. Re: JavaScript to Flash Communication Compatability
      (Jeff Mastropietro)
   7. Re: Re: calling a static method on dynamically    namedclass?
      (Rich Rodecker)
   8. Re: Singleton as associative array - yucky icky? (Nathan Derksen)
   9. Re: Singleton as associative array - yucky icky? (JesterXL)
  10. > Difference keying (Weyert de Boer)
  11. Passing complex structure of parameters to web    service with
      ActionScript (Binyamin Bauman)
  12. RE: Passing complex structure of parameters to    webservice
      with ActionScript (Adrian Lynch)
  13. Re: Singleton as associative array - yucky icky? (g.wygonik)
  14. Re: Singleton as associative array - yucky icky? (Nathan Derksen)
  15. Re: Singleton as associative array - yucky icky? (JesterXL)
  16. Re: Singleton as associative array - yucky icky? (JesterXL)
  17. Re: Re: calling a static method on dynamically    namedclass?
      (Jim Kremens)


----------------------------------------------------------------------

Message: 1
Date: Fri, 30 Dec 2005 09:20:47 -0800
From: Jeff Mastropietro <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] JavaScript to Flash Communication
        Compatability
To: Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Nathan,

Thanks, I was aware of both of the Macromedia methods, and I have switched over to the Macromedia Flash JavaScript Integration Kit. It has pretty poor documentation, and that is why I did not use it initially. I need to support back to Flash 6, so ExternalInterface is out of the question. :(

The sad news is that it still doesn't work in Opera on maemo. The project I am working on needs to run on the new Nokia 770, which runs maemo and uses Opera as the web browser. The flash player version is 6,0,82,0 which should be sufficient to work with my application which now is at version 6,0,65,0. However, it seems that the LocalConnection class is not working, and as a result the Macromedia Flash JavaScript Integration Kit method does not work.

I've found some indication that this is a problem with the flash player plugin for Opera on Linux, and maemo. The Macromedia page says it support Opera on Windows and Mac, but nothing about other platforms.

Jeff



Nathan Derksen wrote:


I haven't seen an up-to-date chart either. You may be interested in knowing that Macromedia already has two ways for you to do this. The first is the Flash JavaScript Integration Kit:

http://weblogs.macromedia.com/flashjavascript/

This uses legacy techniques to make what you are doing work in versions 8 to (I believe) 6, and works in Firefox 1.0+ and Opera 8+.

The other one is the Flash 8 ExternalInterface class. I have an example up at http://www.nathanderksen.com/blog/?p=11 and you can find the documentation at http://livedocs.macromedia.com/flash/8/main/ wwhelp/wwhimpl/common/html/wwhelp.htm? context=LiveDocs_Parts&file=00002200.html. Very slick, but the browser support isn't as good and it only works in Flash 8.

Nathan
http://www.nathanderksen.com


On Dec 28, 2005, at 2:39 PM, Jeff Mastropietro wrote:


I'm working on a project using JavaScript to call functions in a flash movie. I'm currently using the JSFCommunicator Library:
http://www.abdulqabiz.com/files/JSFC/JSFCommunicator%20Library.htm

What I would like to know is, is there a better object available? Also, I'm guessing that all solutions are going to be dependant on the .GetVariable and .SetVariable methods being available to JavaScript. Does anyone know of a more up to date compatability chart than this one?

http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_14159

More specifically, I need to know compatability with Mozilla and Opera browsers.

Thanks,
Jeff
_______________________________________________
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







------------------------------

Message: 2
Date: Fri, 30 Dec 2005 12:38:36 -0500
From: Charles Parcell <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] Undefine a Component
To: Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1

Thanks for the response but that is not really what I am looking for.

Indeed I am use a class.

I am able to revert the component back to a MC by removing all the data in
the Component Definition wizard. But the problem is that it seems to hold
onto that data (some how) even though the wizard is blank.

I was able to drill into my MC and copy all the frames and paste them into a
new MC and relink to my class file. Then I deleted the old MC.  This worked
(of course) but there should be a way to remove all the component definition
data without having to rebuild the MC.

Charles P.



On 12/30/05, GregoryN <[EMAIL PROTECTED]> wrote:


If your component is based on AS2 class - just associate another mc
with it.

If not (as I suspect :) , I'd suggest to make a little/single SWF with
only
this component and then decompile it with Flare or another tool.
You'll get an abstract code, but will be able to restore everything.

Hope this can help you.


--
Best regards,
GregoryN
================================
http://GOusable.com
Flash components development.
Usability services.


-------------  Charles Parcell wrote:
I was working on creating a little component based on a MC I have in my
current project. After playing a little I decided that I would wait till

the

project was done before packaging the component for my team to use.
Somewhere in the process something got mucked up.  When I run my project

the

MC does not behave as it should. As a matter of fact it seems to be

holding

onto variables and values from when I was setting it up as a component

(via

the Component Definition wizard).

My question is, how to you properly reinstate the MC once you have

started

adding component defining properties??

Charles P.


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




------------------------------

Message: 3
Date: Fri, 30 Dec 2005 09:54:06 -0800
From: Nathan Derksen <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] JavaScript to Flash Communication
        Compatability
To: Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;       charset=US-ASCII;       delsp=yes;      
format=flowed

Yah, I feel your pain. While I haven't had to specifically test for Opera, I have had to deal with differences in LiveConnect between IE and Mozilla on Mac (OS 9 and OS X) and Windows. It's truly a PITA.

A technique that I have used to pass data from JavaScript to Flash include using a shim Flash movie that is created with JavaScript every time a message needs to be passed, using FlashVars or URL encoding to pass the variables into the shim clip, which would then pass the message onto the main running Flash movie either through LocalConnection or through SharedObject. If LocalConnection does not work, SharedObject still should as there is no reliance on LiveConnect that I know of. It just means the target movie needs to poll for changes.

Nathan
http://www.nathanderksen.com


On Dec 30, 2005, at 9:20 AM, Jeff Mastropietro wrote:


Nathan,

Thanks, I was aware of both of the Macromedia methods, and I have switched over to the Macromedia Flash JavaScript Integration Kit. It has pretty poor documentation, and that is why I did not use it initially. I need to support back to Flash 6, so ExternalInterface is out of the question. :(

The sad news is that it still doesn't work in Opera on maemo. The project I am working on needs to run on the new Nokia 770, which runs maemo and uses Opera as the web browser. The flash player version is 6,0,82,0 which should be sufficient to work with my application which now is at version 6,0,65,0. However, it seems that the LocalConnection class is not working, and as a result the Macromedia Flash JavaScript Integration Kit method does not work.

I've found some indication that this is a problem with the flash player plugin for Opera on Linux, and maemo. The Macromedia page says it support Opera on Windows and Mac, but nothing about other platforms.

Jeff



Nathan Derksen wrote:


I haven't seen an up-to-date chart either. You may be interested in knowing that Macromedia already has two ways for you to do this. The first is the Flash JavaScript Integration Kit:

http://weblogs.macromedia.com/flashjavascript/

This uses legacy techniques to make what you are doing work in versions 8 to (I believe) 6, and works in Firefox 1.0+ and Opera 8+.

The other one is the Flash 8 ExternalInterface class. I have an example up at http://www.nathanderksen.com/blog/?p=11 and you can find the documentation at http://livedocs.macromedia.com/flash/8/ main/ wwhelp/wwhimpl/common/html/wwhelp.htm? context=LiveDocs_Parts&file=00002200.html. Very slick, but the browser support isn't as good and it only works in Flash 8.

Nathan
http://www.nathanderksen.com


On Dec 28, 2005, at 2:39 PM, Jeff Mastropietro wrote:


I'm working on a project using JavaScript to call functions in a flash movie. I'm currently using the JSFCommunicator Library:
http://www.abdulqabiz.com/files/JSFC/JSFCommunicator%20Library.htm

What I would like to know is, is there a better object available? Also, I'm guessing that all solutions are going to be dependant on the .GetVariable and .SetVariable methods being available to JavaScript. Does anyone know of a more up to date compatability chart than this one?

http://www.macromedia.com/cfusion/knowledgebase/index.cfm? id=tn_14159

More specifically, I need to know compatability with Mozilla and Opera browsers.

Thanks,
Jeff
_______________________________________________
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




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





------------------------------

Message: 4
Date: Fri, 30 Dec 2005 11:55:14 -0600
From: "g.wygonik" <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] Singleton as associative array - yucky
        icky?
To: Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1

lol - indeed. :-)

i'm just trying to look at possible "issues" that may come up later
on... but this scenario brings up two follow-up questions/concerns:

1 - the fact that Flash (AS2) will happily turn a class into an
associative array without any sort of warning. if a coder comes in and
uses session["foo"], it will work with no errors thrown. can i catch
this somehow? should they use this syntax throughout their modules, it
will work with no problems, but won't be "correct".

2 - can i somehow catch items being added to the class via the
ass-array method and properly add them to the Items array instead of
the root class? in other words, say a user does use the session["foo"]
method. can i intercept that call, add the item/value to the Items
array and remove it from the class? i thought about some sort of
watch, but i wouldn't know what to watch in this case...

while i'm going to be setting up a proper API for them to use, in a
way this conversation is over from a "real world" standpoint. but i'd
like to figure this out from a theoretical standpoint now.

g.

On 12/30/05, Nathan Derksen <[EMAIL PROTECTED]> wrote:

I would say to hell with the VB coders (and I used to be one). What
if you want to change your implementation later on? What if this
functionality changes with AS3? Without an API, you open yourself up
to all sorts of fun stuff that may force the user to have to change
their code later on. Be nice to yourself and to your users. You'll be
happier in the end, and your guilt will be assuaged (rightly so)! And
when was the last time that VB/VBScript catered to anyone in the
Java, JavaScript, or ActionScript world? They use completely
different syntax, so don't fret about it.

Nathan
http://www.nathanderksen.com



--
weblog: broadcast.artificialcolors.com
blazePDF: www.blazepdf.com
band: www.cutratebox.com


------------------------------

Message: 5
Date: Fri, 30 Dec 2005 12:09:24 -0600
From: Judah Frangipane <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] Remote Debugging + Flash Remoting = Frozen
        Browser.        FP8 Bug?
To: Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

I don't think it captures that but it might be a feature that can be added. I would ask on the Service Capture feature forum.

http://kevinlangdon.com/phpBB2/


elibol wrote:


I've got a question, is there a way to set Service Capture to detect the
requests made by the client? Is there a way to detect remote client service
activity?

H

On 12/30/05, elibol <[EMAIL PROTECTED]> wrote:



Thanks for your reply Judah, I accually use service capture myself!

Well, I will see to it that this debugger bug (the irony) is
acknowledged...

H

On 12/29/05, Judah Frangipane <[EMAIL PROTECTED]> wrote:

I'm not using cf but in my remoting endevors Service Capture has helped
many times (http://www.kevinlangdon.com/phpBB2/). It is well worth it
compared to the time spent tracking down bugs.

Judah
PS No, I do not work for them :)

elibol wrote:


Hi everyone,

I use the remote debugger all the time, and now with the release of

flash 8,

debugging an application that makes a flash remoting call (CF serving

CFC)

will either freeze or crash the subject browser. In the case that it
freezes, my application will sometimes recover if I stop the debugger.

What happens is my CPU usage maxes out when a remote function call is

made

in the application (while I'm running the remote debugger for that
application), and the "there may be an inifinite loop that's slowing

your

machine down" dialogue appears since the player mistakes the situation

as an

infinite loop.

I'm using CF with a CFC Oracle database facade; is anyone else

experiencing

the same problems as I am under either the same or different server
technologies? Has this bug been acknowledged?

Thanks so much for reading about my problem,

H
_______________________________________________
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



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









------------------------------

Message: 6
Date: Fri, 30 Dec 2005 10:09:15 -0800
From: Jeff Mastropietro <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] JavaScript to Flash Communication
        Compatability
To: Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Nathan,

SharedObject is an option I had not considered. I imagine that the finished interface would work as hybrid of the Macromedia Flash JavaScript Integration Kit, and the JSFCommunicator Library with SharedObject as the communication layer. The JSFCommunicator Library uses the .SetVariable to send in parameters to the movie and then in the movie a component checks for new parameters on every frame. I'll explore that possiblity some more.

Thanks,
Jeff

Nathan Derksen wrote:


Yah, I feel your pain. While I haven't had to specifically test for Opera, I have had to deal with differences in LiveConnect between IE and Mozilla on Mac (OS 9 and OS X) and Windows. It's truly a PITA.

A technique that I have used to pass data from JavaScript to Flash include using a shim Flash movie that is created with JavaScript every time a message needs to be passed, using FlashVars or URL encoding to pass the variables into the shim clip, which would then pass the message onto the main running Flash movie either through LocalConnection or through SharedObject. If LocalConnection does not work, SharedObject still should as there is no reliance on LiveConnect that I know of. It just means the target movie needs to poll for changes.

Nathan
http://www.nathanderksen.com


On Dec 30, 2005, at 9:20 AM, Jeff Mastropietro wrote:


Nathan,

Thanks, I was aware of both of the Macromedia methods, and I have switched over to the Macromedia Flash JavaScript Integration Kit. It has pretty poor documentation, and that is why I did not use it initially. I need to support back to Flash 6, so ExternalInterface is out of the question. :(

The sad news is that it still doesn't work in Opera on maemo. The project I am working on needs to run on the new Nokia 770, which runs maemo and uses Opera as the web browser. The flash player version is 6,0,82,0 which should be sufficient to work with my application which now is at version 6,0,65,0. However, it seems that the LocalConnection class is not working, and as a result the Macromedia Flash JavaScript Integration Kit method does not work.

I've found some indication that this is a problem with the flash player plugin for Opera on Linux, and maemo. The Macromedia page says it support Opera on Windows and Mac, but nothing about other platforms.

Jeff



Nathan Derksen wrote:


I haven't seen an up-to-date chart either. You may be interested in knowing that Macromedia already has two ways for you to do this. The first is the Flash JavaScript Integration Kit:

http://weblogs.macromedia.com/flashjavascript/

This uses legacy techniques to make what you are doing work in versions 8 to (I believe) 6, and works in Firefox 1.0+ and Opera 8+.

The other one is the Flash 8 ExternalInterface class. I have an example up at http://www.nathanderksen.com/blog/?p=11 and you can find the documentation at http://livedocs.macromedia.com/flash/8/ main/ wwhelp/wwhimpl/common/html/wwhelp.htm? context=LiveDocs_Parts&file=00002200.html. Very slick, but the browser support isn't as good and it only works in Flash 8.

Nathan
http://www.nathanderksen.com


On Dec 28, 2005, at 2:39 PM, Jeff Mastropietro wrote:


I'm working on a project using JavaScript to call functions in a flash movie. I'm currently using the JSFCommunicator Library:
http://www.abdulqabiz.com/files/JSFC/JSFCommunicator%20Library.htm

What I would like to know is, is there a better object available? Also, I'm guessing that all solutions are going to be dependant on the .GetVariable and .SetVariable methods being available to JavaScript. Does anyone know of a more up to date compatability chart than this one?

http://www.macromedia.com/cfusion/knowledgebase/index.cfm? id=tn_14159

More specifically, I need to know compatability with Mozilla and Opera browsers.

Thanks,
Jeff
_______________________________________________
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




_______________________________________________
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







------------------------------

Message: 7
Date: Fri, 30 Dec 2005 10:14:17 -0800
From: Rich Rodecker <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] Re: calling a static method on dynamically
        namedclass?
To: Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1

yeah, that works, but you are calling the static create() method through the
name of the class itself.  Say I have a number of classes (MyClass1,
MyOtherClass, AnotherClass) and I be able to alter which class to call the
create method on.  I'm thinking there's got to be a way to do something
like:

//set the name of the class to call the create() method on
var classToCall = "MyClass";
_global[classToCall].create();

//change the name of the class to call create() on
classToCall = "MyOtherClass";
_global[classToCall].create();

again
classToCall = "AnotherClass";
_global[classToCall].create();




On 12/29/05, JesterXL <[EMAIL PROTECTED]> wrote:

Hrm... how about:

class com.packageName.MyClass
{
   public static function create():MyClass
   {
       var inst:MyClass = new MyClass();
       return inst;
   }

   public function toString():String
   {
       return "[MyClass]";
   }
}

import com.packageName.MyClass;
trace(MyClass.create());


----- Original Message -----
From: "Rich Rodecker" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Thursday, December 29, 2005 11:35 PM
Subject: [Flashcoders] Re: calling a static method on dynamically
namedclass?


hmm i tried storing a reference to the class in a variable, like

var myClass = com.packageName.MyClass

myClass.create()



and i got this message:

Static members can only be accessed directly through classes


there's gotta be a way to pull this off.






On 12/29/05, Rich Rodecker <[EMAIL PROTECTED]> wrote:

I know you can instantiate objects by doing:

var myObj = new _global[className]();
var className = "TestClass";

but is it possible to call a static method of a class in a similar way?
Im trying these two ways, and its not working for me:

_global[iconName].create()
_global[iconName]().create()


if I try and do a trace on the class like trace( _global[iconName]) i

get

undefined.  The icon classes are subclasses of movieclip so that might
make
a difference.


_______________________________________________
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




------------------------------

Message: 8
Date: Fri, 30 Dec 2005 10:20:44 -0800
From: Nathan Derksen <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] Singleton as associative array - yucky
        icky?
To: Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;       charset=US-ASCII;       delsp=yes;      
format=flowed

Well, consider how an object can be manipulated.

var myObject:Object = new Object();
myObject.foo = "bar";

or

var myObject:Object = new Object();
myObject["foo"] = "bar";

Those are equivalent syntaxes. Everything basically inherits from Object, so this is valid syntax throughout, including your custom classes. Basically, you are accessing (and apparently creating) properties on the fly, with no type checking, and no compiler validation as to whether the property being accessed actually exists.

You can see a bit more of this if you consider the XML class:

var myXML:XML = new XML();
myXML.foo = "bar";

In this case, foo is not a valid property of the XML class, so the compiler spits out an error. However, if you do this:

var myXML:XML = new XML();
myXML["foo"] = "bar";

the compiler happily allows it, and a trace on myXML.foo reveals the value "bar".

One more thing, the LoadVars class takes advantage of the fact that the class is just a collection of properties. It allows for the arbitrary addition of properties using both syntaxes:

var myLV:LoadVars = new LoadVars();
myLV.foo = "bar";
myLV["baz"] -= "quux";
myLV.sendAndLoad("foo.jsp");

In many respects, LoadVars is doing what you want to do with your Session class.

Fun, eh!

Regarding number 2, that is what getters and setters are normally for. With arbitrary properties, someone correct me if I am wrong, but I don't think there is a way of intercepting them all, just specific ones that you have defined.

Nathan
http://www.nathanderksen.com


On Dec 30, 2005, at 9:55 AM, g.wygonik wrote:


lol - indeed. :-)

i'm just trying to look at possible "issues" that may come up later
on... but this scenario brings up two follow-up questions/concerns:

1 - the fact that Flash (AS2) will happily turn a class into an
associative array without any sort of warning. if a coder comes in and
uses session["foo"], it will work with no errors thrown. can i catch
this somehow? should they use this syntax throughout their modules, it
will work with no problems, but won't be "correct".

2 - can i somehow catch items being added to the class via the
ass-array method and properly add them to the Items array instead of
the root class? in other words, say a user does use the session["foo"]
method. can i intercept that call, add the item/value to the Items
array and remove it from the class? i thought about some sort of
watch, but i wouldn't know what to watch in this case...

while i'm going to be setting up a proper API for them to use, in a
way this conversation is over from a "real world" standpoint. but i'd
like to figure this out from a theoretical standpoint now.

g.




------------------------------

Message: 9
Date: Fri, 30 Dec 2005 13:31:48 -0500
From: "JesterXL" <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] Singleton as associative array - yucky
        icky?
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;       charset="iso-8859-1"

Correct. __resolve can catch arbitrary function calls, but not arbritary variable assignments.

----- Original Message ----- From: "Nathan Derksen" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Friday, December 30, 2005 1:20 PM
Subject: Re: [Flashcoders] Singleton as associative array - yucky icky?


Well, consider how an object can be manipulated.

var myObject:Object = new Object();
myObject.foo = "bar";

or

var myObject:Object = new Object();
myObject["foo"] = "bar";

Those are equivalent syntaxes. Everything basically inherits from
Object, so this is valid syntax throughout, including your custom
classes. Basically, you are accessing (and apparently creating)
properties on the fly, with no type checking, and no compiler
validation as to whether the property being accessed actually exists.

You can see a bit more of this if you consider the XML class:

var myXML:XML = new XML();
myXML.foo = "bar";

In this case, foo is not a valid property of the XML class, so the
compiler spits out an error. However, if you do this:

var myXML:XML = new XML();
myXML["foo"] = "bar";

the compiler happily allows it, and a trace on myXML.foo reveals the
value "bar".

One more thing, the LoadVars class takes advantage of the fact that
the class is just a collection of properties. It allows for the
arbitrary addition of properties using both syntaxes:

var myLV:LoadVars = new LoadVars();
myLV.foo = "bar";
myLV["baz"] -= "quux";
myLV.sendAndLoad("foo.jsp");

In many respects, LoadVars is doing what you want to do with your
Session class.

Fun, eh!

Regarding number 2, that is what getters and setters are normally
for. With arbitrary properties, someone correct me if I am wrong, but
I don't think there is a way of intercepting them all, just specific
ones that you have defined.

Nathan
http://www.nathanderksen.com


On Dec 30, 2005, at 9:55 AM, g.wygonik wrote:


lol - indeed. :-)

i'm just trying to look at possible "issues" that may come up later
on... but this scenario brings up two follow-up questions/concerns:

1 - the fact that Flash (AS2) will happily turn a class into an
associative array without any sort of warning. if a coder comes in and
uses session["foo"], it will work with no errors thrown. can i catch
this somehow? should they use this syntax throughout their modules, it
will work with no problems, but won't be "correct".

2 - can i somehow catch items being added to the class via the
ass-array method and properly add them to the Items array instead of
the root class? in other words, say a user does use the session["foo"]
method. can i intercept that call, add the item/value to the Items
array and remove it from the class? i thought about some sort of
watch, but i wouldn't know what to watch in this case...

while i'm going to be setting up a proper API for them to use, in a
way this conversation is over from a "real world" standpoint. but i'd
like to figure this out from a theoretical standpoint now.

g.


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


------------------------------

Message: 10
Date: Fri, 30 Dec 2005 20:00:26 +0100
From: Weyert de Boer <[EMAIL PROTECTED]>
Subject: [Flashcoders] > Difference keying
To: Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hello!

I would like to key away the background of video footage or a live webcam video stream. The idea is to use the first frame of the video stream as the clean plate for the key. Meaning background without any of the foreground elements. Only I thought maybe it's a good idea to ask first at the mailing list before reinventing the wheel. My question is does anyone here already happen to have such a example working in Flash 8?

Thanks.

Yours,
Weyert de Boer


------------------------------

Message: 11
Date: Fri, 30 Dec 2005 14:02:53 -0500
From: Binyamin Bauman <[EMAIL PROTECTED]>
Subject: [Flashcoders] Passing complex structure of parameters to web
        service with ActionScript
To: flashcoders@chattyfig.figleaf.com
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

I have been cracking my head against this for days.  I am trying to consume
a web service that requires a complex structure of parameters to be passed
with every call.  See attached screenshot for WSDL structure.  I am trying
to use WebService classes to make the call as follows.  Let me know if you
can tell me what I am doing wrong, I will pay!

Thanks,

Ben

//create parameter object

params = {

            request:{

                        reqHeader:{

                                    organization: "Blah",

                                    department: "thigny",

                                    application: "wierdo",

                                    userID: "viga",

                                    messageID: "blinga",

                                    timeStamp: Date,

                                    locale: "pisa"

                        },

                        businessHeader:{

                                    B2BPartnerID: 3,

                                    B2BPartnerUser: "miss",

                                    B2BPartnerPassword: "why",

                                    partnerOrderID: "ya",

                                    partnerTransactionID: "maybe",

                                    callBackURL: "itcouldbe",

                                    preallocatedServiceAccount: "string",

                                    preallocatedGABKey: "grizzle"

                        },

                        getSubscriberInfoRequestHeader:{

                                    subLocator:{

                                                externalSystemID: "bling",

                                                externalCustomerID:
"stringy",

                                                externalSalesChannel: "hi",

                                                externalClientReference:
"Hi",

                                                subscriberID: "hind",

                                                serviceAccount: "Hilasd",

                                                email: "emails",

                                                firstName: "Dave",

                                                lastName: "fizzled",

                                                tn: "12345"

                                    }

                        }

            }

}

//make the call

itamarResultObj = itamar.GetSubscriberInfo(params);

------------------------------

Message: 12
Date: Fri, 30 Dec 2005 19:11:18 -0000
From: "Adrian Lynch" <[EMAIL PROTECTED]>
Subject: RE: [Flashcoders] Passing complex structure of parameters to
        webservice with ActionScript
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;       charset="iso-8859-1"

I don't know the answer, but you owe me £4.50 just for reading your email
:OD

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Binyamin
Bauman
Sent: 30 December 2005 19:03
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Passing complex structure of parameters to
webservice with ActionScript


I have been cracking my head against this for days.  I am trying to consume
a web service that requires a complex structure of parameters to be passed
with every call.  See attached screenshot for WSDL structure.  I am trying
to use WebService classes to make the call as follows.  Let me know if you
can tell me what I am doing wrong, I will pay!

Thanks,

Ben

//create parameter object

params = {

            request:{

                        reqHeader:{

                                    organization: "Blah",

                                    department: "thigny",

                                    application: "wierdo",

                                    userID: "viga",

                                    messageID: "blinga",

                                    timeStamp: Date,

                                    locale: "pisa"

                        },

                        businessHeader:{

                                    B2BPartnerID: 3,

                                    B2BPartnerUser: "miss",

                                    B2BPartnerPassword: "why",

                                    partnerOrderID: "ya",

                                    partnerTransactionID: "maybe",

                                    callBackURL: "itcouldbe",

                                    preallocatedServiceAccount: "string",

                                    preallocatedGABKey: "grizzle"

                        },

                        getSubscriberInfoRequestHeader:{

                                    subLocator:{

                                                externalSystemID: "bling",

                                                externalCustomerID:
"stringy",

                                                externalSalesChannel: "hi",

                                                externalClientReference:
"Hi",

                                                subscriberID: "hind",

                                                serviceAccount: "Hilasd",

                                                email: "emails",

                                                firstName: "Dave",

                                                lastName: "fizzled",

                                                tn: "12345"

                                    }

                        }

            }

}

//make the call

itamarResultObj = itamar.GetSubscriberInfo(params);



------------------------------

Message: 13
Date: Fri, 30 Dec 2005 13:16:27 -0600
From: "g.wygonik" <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] Singleton as associative array - yucky
        icky?
To: Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1

On 12/30/05, Nathan Derksen <[EMAIL PROTECTED]> wrote:

Those are equivalent syntaxes. Everything basically inherits from
Object, so this is valid syntax throughout, including your custom
classes. Basically, you are accessing (and apparently creating)
properties on the fly, with no type checking, and no compiler
validation as to whether the property being accessed actually exists.


while that is true, i thought that was what the "dynamic" keyword was
to allow, and without it, you'd get some sort of error...


In many respects, LoadVars is doing what you want to do with your
Session class.


well, in ways, yes - in ways, no. it's doing the same on-the-fly
variable assignment, but doesn't have any other methods (like
"addItem") that would put keys/values into a specific class member.

it seems that LoadVars just iterates over the object and outputs any
property it finds (which is why "onLoad=function" used to appear in
LoadVars data).

i was doing iterations over both the class object and the Items
member. i'd obviously prefer just to have one place for all props.


Regarding number 2, that is what getters and setters are normally
for. With arbitrary properties, someone correct me if I am wrong, but
I don't think there is a way of intercepting them all, just specific
ones that you have defined.


indeed there's none that i know of... but i've seen some folks do some
strange things with Flash here ;-)

as Jesse pointed out, __resolve won't work with variable assignments -
so AFAIK, there's no nice way to handle this.

g.

--
weblog: broadcast.artificialcolors.com
blazePDF: www.blazepdf.com
band: www.cutratebox.com


------------------------------

Message: 14
Date: Fri, 30 Dec 2005 11:24:18 -0800
From: Nathan Derksen <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] Singleton as associative array - yucky
        icky?
To: Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;       charset=US-ASCII;       delsp=yes;      
format=flowed


On 12/30/05, Nathan Derksen <[EMAIL PROTECTED]> wrote:

while that is true, i thought that was what the "dynamic" keyword was
to allow, and without it, you'd get some sort of error...


That's the theory, but as the XML example shows, using the associative array syntax gets around the compile-time checking for that.


In many respects, LoadVars is doing what you want to do with your
Session class.

well, in ways, yes - in ways, no. it's doing the same on-the-fly
variable assignment, but doesn't have any other methods (like
"addItem") that would put keys/values into a specific class member.

it seems that LoadVars just iterates over the object and outputs any
property it finds (which is why "onLoad=function" used to appear in
LoadVars data).

i was doing iterations over both the class object and the Items
member. i'd obviously prefer just to have one place for all props.


Yah, that's why it is so much cleaner just to have an associative array as a private property within your class, and create addItem(), getItem(), and removeItem() methods to manage that associative array. That way you also don't have to worry about the names of added properties possibly colliding with existing property/method names within the class.

Nathan
http://www.nathanderksen.com




------------------------------

Message: 15
Date: Fri, 30 Dec 2005 14:34:08 -0500
From: "JesterXL" <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] Singleton as associative array - yucky
        icky?
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;       charset="iso-8859-1"

Flash won't bitch when you do this:

my_xml["owner"]

Flex 1 & 1.5 will give you a warning.

Flex 2 bitches if owner isn't public.


----- Original Message ----- From: "Nathan Derksen" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Friday, December 30, 2005 2:24 PM
Subject: Re: [Flashcoders] Singleton as associative array - yucky icky?



On 12/30/05, Nathan Derksen <[EMAIL PROTECTED]> wrote:

while that is true, i thought that was what the "dynamic" keyword was
to allow, and without it, you'd get some sort of error...


That's the theory, but as the XML example shows, using the associative array syntax gets around the compile-time checking for that.


In many respects, LoadVars is doing what you want to do with your
Session class.

well, in ways, yes - in ways, no. it's doing the same on-the-fly
variable assignment, but doesn't have any other methods (like
"addItem") that would put keys/values into a specific class member.

it seems that LoadVars just iterates over the object and outputs any
property it finds (which is why "onLoad=function" used to appear in
LoadVars data).

i was doing iterations over both the class object and the Items
member. i'd obviously prefer just to have one place for all props.


Yah, that's why it is so much cleaner just to have an associative array as a private property within your class, and create addItem(), getItem(), and removeItem() methods to manage that associative array. That way you also don't have to worry about the names of added properties possibly colliding with existing property/method names within the class.

Nathan
http://www.nathanderksen.com


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


------------------------------

Message: 16
Date: Fri, 30 Dec 2005 14:39:02 -0500
From: "JesterXL" <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] Singleton as associative array - yucky
        icky?
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;       charset="iso-8859-1"

I forget what MTASC does....  I think it throws a warning too.

----- Original Message ----- From: "JesterXL" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Friday, December 30, 2005 2:34 PM
Subject: Re: [Flashcoders] Singleton as associative array - yucky icky?


Flash won't bitch when you do this:

my_xml["owner"]

Flex 1 & 1.5 will give you a warning.

Flex 2 bitches if owner isn't public.


----- Original Message ----- From: "Nathan Derksen" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Friday, December 30, 2005 2:24 PM
Subject: Re: [Flashcoders] Singleton as associative array - yucky icky?



On 12/30/05, Nathan Derksen <[EMAIL PROTECTED]> wrote:

while that is true, i thought that was what the "dynamic" keyword was
to allow, and without it, you'd get some sort of error...


That's the theory, but as the XML example shows, using the associative array syntax gets around the compile-time checking for that.


In many respects, LoadVars is doing what you want to do with your
Session class.

well, in ways, yes - in ways, no. it's doing the same on-the-fly
variable assignment, but doesn't have any other methods (like
"addItem") that would put keys/values into a specific class member.

it seems that LoadVars just iterates over the object and outputs any
property it finds (which is why "onLoad=function" used to appear in
LoadVars data).

i was doing iterations over both the class object and the Items
member. i'd obviously prefer just to have one place for all props.


Yah, that's why it is so much cleaner just to have an associative array as a private property within your class, and create addItem(), getItem(), and removeItem() methods to manage that associative array. That way you also don't have to worry about the names of added properties possibly colliding with existing property/method names within the class.

Nathan
http://www.nathanderksen.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


------------------------------

Message: 17
Date: Fri, 30 Dec 2005 14:45:49 -0500
From: Jim Kremens <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] Re: calling a static method on dynamically
        namedclass?
To: Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1

"//set the name of the class to call the create() method on
var classToCall = "MyClass";
_global[classToCall].create();

//change the name of the class to call create() on
classToCall = "MyOtherClass";
_global[classToCall].create();

again
classToCall = "AnotherClass";
_global[classToCall].create();"

I'm not currently on a machine where I can test, but that should work
as long as you
declare the classes somewhere first.  I sometimes have a class that I
use to do just that:

class Dependencies {

  public function Dependencies() {
      //list fully declared class names here
      com.class1;
      com.class2;
      com.class3;
  }
}

var d: Dependencies = new Dependencies();
//even better to make it a singleton....

As long as you've listed the fully declared class names somewhere in
your compiled swf, Flash will be able to provide dynamic access to
them.  If you don't list them, it will not allow you to instantiate
them out of thin air.

So, once you've done the above,

classToCall = class1;
_global[classToCall].create();

should work just fine.

Jim Kremens

On 12/30/05, Rich Rodecker <[EMAIL PROTECTED]> wrote:

yeah, that works, but you are calling the static create() method through the
name of the class itself.  Say I have a number of classes (MyClass1,
MyOtherClass, AnotherClass) and I be able to alter which class to call the
create method on.  I'm thinking there's got to be a way to do something
like:

//set the name of the class to call the create() method on
var classToCall = "MyClass";
_global[classToCall].create();

//change the name of the class to call create() on
classToCall = "MyOtherClass";
_global[classToCall].create();

again
classToCall = "AnotherClass";
_global[classToCall].create();




On 12/29/05, JesterXL <[EMAIL PROTECTED]> wrote:

Hrm... how about:

class com.packageName.MyClass
{
   public static function create():MyClass
   {
       var inst:MyClass = new MyClass();
       return inst;
   }

   public function toString():String
   {
       return "[MyClass]";
   }
}

import com.packageName.MyClass;
trace(MyClass.create());


----- Original Message -----
From: "Rich Rodecker" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Thursday, December 29, 2005 11:35 PM
Subject: [Flashcoders] Re: calling a static method on dynamically
namedclass?


hmm i tried storing a reference to the class in a variable, like

var myClass = com.packageName.MyClass

myClass.create()



and i got this message:

Static members can only be accessed directly through classes


there's gotta be a way to pull this off.






On 12/29/05, Rich Rodecker <[EMAIL PROTECTED]> wrote:

I know you can instantiate objects by doing:

var myObj = new _global[className]();
var className = "TestClass";

but is it possible to call a static method of a class in a similar way?
Im trying these two ways, and its not working for me:

_global[iconName].create()
_global[iconName]().create()


if I try and do a trace on the class like trace( _global[iconName]) i

get

undefined.  The icon classes are subclasses of movieclip so that might
make
a difference.


_______________________________________________
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


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




--
Jim Kremens


------------------------------

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

End of Flashcoders Digest, Vol 11, Issue 100
********************************************


--
-----------

Jiri Heitlager
Stichting z25.org
Concordiastraat 67A
3551 EM Utrecht

tel:06-28159323
http://www.z25.org
[EMAIL PROTECTED]

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

Reply via email to