[Flashcoders] Workflow question: attaching scripts to external movieClips

2006-08-20 Thread js
I was searching for a solution to an issue that I am having and I came 
across a post in the Flashcoders archive from 2005. The post describes 
exactly the same issues I am having right now, but it was 
unfortunately never answered. If anyone can address the issues 
described in the post below, it would be GREATLY appreciated as it is 
 making me absolutely insane at the moment.


http://chattyfig.figleaf.com/pipermail/flashcoders/2005-September/150253.html

Joseph
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Array Empowerment

2006-07-26 Thread js
As a relative newcomer to Actionscript, I have found the entirety of 
this thread very useful. I want to thank all of you for sharing this 
code, as well as providing a considerable amount of insight to those 
of us lurking in the shadows.


I was fairly surprised to see that if(this.length == 0) is considered 
sloppy opposed to (!this.length); conjointly, I had no idea that 
iterating through an array in the way you described was bad practice 
either. I'm sure I've done it quite a few times myself, unaware of the 
consequences.


It would be very beneficial for those of us who are not up to such 
(relatively) meticulous levels of coding practice if there was some 
sort of resource which enumerated a list of best coding practices when 
optimizing for speed--something along the lines of the similarly 
titled article in the flash documentation but aimed at the 
middle-class coder.


I don't think I would be the only individual to appreciate such a 
resource; if anyone knows of something similar, do share!


Joseph


Steven Sacks | BLITZ wrote:

DataProvider is not secretly decorating things, BUT something

somewhere

in the V2 stuff is iterating over the array object itself, and is
silently blowing up when it finds these extra functions. I've had a
similar problem when some third party code was adding a function to
object.prototype, and the WebService object took a dump (it iterates
over a hash object and sees something weird and throws an error).


This is an example of poor coding by MM's component writers.  You
shouldn't be iterating through enumerable arrays using for (var a in
this) because you're going to pick up all the methods of the Array
object, as well.  It's just sloppy coding due to how loose Flash is with
its typing.  I always try to write as careful code as possible to avoid
the oh so enticing opportunities flash provides for sloppy coding.
Things like if (!this.length) versus if (this.length == 0)...

However, using ASSetPropFlags is the best solution to hide functions so
they don't appear when you iterate through an Array object.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Array Empowerment

2006-07-26 Thread js



Steven Sacks | BLITZ wrote:

As a relative newcomer to Actionscript, I have found the entirety of
this thread very useful. I want to thank all of you for sharing this
code, as well as providing a considerable amount of insight to those
of us lurking in the shadows.


Glad to hear it.

 

I was fairly surprised to see that if(this.length == 0) is considered
sloppy opposed to (!this.length); conjointly, I had no idea that
iterating through an array in the way you described was bad practice
either. I'm sure I've done it quite a few times myself, unaware of the
consequences.


The opposite.  if (this.length == 0) is not sloppy code because it is
explicitly stating what you are expecting, versus accepting anything
that resolves as false in Flash, which includes 0, false, null and
undefined.  You are being strict about what you expect and your code
will be easier to debug because of it, and you will be a stronger
programmer because you are well disciplined and don't take shortcuts
which could potentially come back to haunt you.



Thanks for clearing this up. You didn't really indicate a reason 
between both methods when you said I always try to write as careful 
code as possible to avoid the oh so enticing opportunities flash 
provides for sloppy coding. Things like if (!this.length) versus if 
(this.length == 0)..., so I wasn't sure which you were referring to 
as the sloppy or correct way.


To me it has always seemed more logical to use if this.length == 0 for 
the very reason of explicitness that you stated; and thus, using the 
alternative !this.length was less enticing. I speculated (wrongly) 
after reading your post that there might be some sort of speed 
optimization inherent to checking if something is false than actually 
checking for a specific length defined explicitly in your code. I 
don't know why I thought that, and obviously I am wrong for the 
various reasons stated earlier.






It would be very beneficial for those of us who are not up to such
(relatively) meticulous levels of coding practice if there was some
sort of resource which enumerated a list of best coding practices when
optimizing for speed--something along the lines of the similarly
titled article in the flash documentation but aimed at the
middle-class coder.


I know I don't have time to do this, and I've had to do my own research
over the years to find out this information, and that's fine by me
because it has made me a more resourceful developer.  For loop speed has
been covered numerous times throughout the life of this mailing list and
searching the archives will shed light on lots of different things (use
google to search the archives, the built-in Flashcoders archive search
is broken).


I wasn't asking you to create this resource, just simply stating the 
fact that such would be considerably valuable to many. It might also 
eliminate some of the frequent and routine questions that bother some 
of you so frequently ;).


Searching through the archives is a great thing--predicating one 
actually knows what to search for. In my humble opinion there is much 
more to be said for a unified, centralized, and cohesive source of 
information that has been peer reviewed and updated collectively.


While useful, the archives suffer from discontinuity by the very 
nature of this platform. A mailing list is intrinsically disconnected; 
each post is like a puzzle piece to a much larger concept which 
may--or may not--be accurate, dated, and/or relevant at all to your 
problem at hand. Yet, in order to derive any utility at all, you are 
still faced with the task of assembling the puzzle.


As a sound engineer, graphic artist, photographer, writer, and more 
recently a developer, I don't have the enormous amount of time that I 
would like to wade through mountains of posts in order to arrive at a 
very specific destination. It is not efficient nor realistic to expect 
people to drudge through a pile of loose un-scrutinized data that is 
growing at an exponential rate.


This is just my opinion though.



And besides, if I say to you that this is the fastest for loop (but not
the fastest loop in Flash):

for (var i = len; --i -(-1); ) {}

You're going to ask why, especially given its funky syntax. Yes, it's a
for loop with only two parameters instead of three and the compiler has
no problem with it.  The answer to why is explained by the guys who
wrote Flasm.  If you want to learn more about how the Flash player works
and how to really optimize your code, check out Flasm.

Performance enchancers like putting the more likely result first in an
if statement, the fastest possible loop while(--a -(-1)), etc. are
explained by how Flash compiles your Actionscript into bytecode.

Anyway, good luck!


This sounds interesting; and I will surely look into it. I might even 
create a document fully explaining the issues I encounter, for which I 
would love to get any collaborative input from anyone on this list 
when the time comes.


Thank 

[Flashcoders] Issue with reapeat test publish

2006-07-02 Thread js
When I test publish a file the first time, everything works as 
expected. However when I press ctl-enter again (while the window is 
still open), absolutely nothing works. If I close the window, and then 
test-publish again from within the IDE, the file works again. Has 
anyone else experienced this? How can I fix this?


Joseph
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Accurate duration info from the Sound Class

2006-07-01 Thread js
Since mySound.duration reflects *loaded* duration - there is no way to 
get the actual duration of a loaded mp3 through the Sound class.


A work around and what I've been doing: Divide mySound.getBytesLoaded 
by mySound.getBytesTotal to get a percentage of the song that is 
currently loaded; and then take mySound.duration and divide that by 
the percentage loaded. Provided that the duration property of mySound 
is accurately representing the amount of ms loaded, I should arrive at 
 an accurate result.


Unfortunately, both properties do not synchronize 100%, and the 
duration value progressively gains accuracy as the mp3 loads, opposed 
to getting a correct duration immediately.


I would really like to find a more accurate way. Ideally I would like 
to get the complete duration of a loaded mp3 through flash immediately 
upon stream so the end-user doesn't see the progress bar jutting 
backwards and the total duration value slowly increasing as the song 
loads--without depending on external scripts or an xml playlist 
file...etc.


Any help / insight appreciated,
Joseph Sorensen
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Accurate duration info from the Sound Class

2006-07-01 Thread js

If I may rephrase that first sentence:

There is no way to get the actual duration of a *loading* mp3 through 
the Sound class.


Regards

js wrote:
Since mySound.duration reflects *loaded* duration - there is no way to 
get the actual duration of a loaded mp3 through the Sound class.


A work around and what I've been doing: Divide mySound.getBytesLoaded by 
mySound.getBytesTotal to get a percentage of the song that is currently 
loaded; and then take mySound.duration and divide that by the percentage 
loaded. Provided that the duration property of mySound is accurately 
representing the amount of ms loaded, I should arrive at  an accurate 
result.


Unfortunately, both properties do not synchronize 100%, and the duration 
value progressively gains accuracy as the mp3 loads, opposed to getting 
a correct duration immediately.


I would really like to find a more accurate way. Ideally I would like to 
get the complete duration of a loaded mp3 through flash immediately upon 
stream so the end-user doesn't see the progress bar jutting backwards 
and the total duration value slowly increasing as the song 
loads--without depending on external scripts or an xml playlist file...etc.


Any help / insight appreciated,
Joseph Sorensen
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Re: loadvars vs xml onData

2006-06-28 Thread js
I saw you asking this question the other day on EFNet. Apologies if I 
can't be of much help, but, intuitively the first explanation (and 
only explanation) that I can think of is that you are incurring some 
sort of overhead due to the higher size and complexity of the XML 
class. How this could possibly translate to a difference of 5-10ms... 
I don't know.


Maybe it wouldn't be a bad idea to run several tests with different 
sized text files and try to narrow or widen the deviance?


Either way, it's nice to know this.

Joseph
('Formless' on EFNet/#flash/#actionscript)

Andreas Rønning wrote:
I don't run them concurrently. They're entirely separate tests. Earlier 
i tried concurrent tests where yes, flipping the order 
(loadvars/xml-xml/loadvars) did make a difference.


The bottom line is, currently, for loading data such as raw text, 
loadVars.onData is slightly faster than xml.onData. It doesn't bug me. 
I'm just surprised there's a 5-10ms difference.


- Andreas

Mike wrote:

But if you run the XML test first, and the LoadVars test just loads
the cached file
--
T. Michael Keesey

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jim
Kremens
Sent: Tuesday, June 27, 2006 5:39 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Re: loadvars vs xml onData

Why would that matter?  I would assume that the loadvars and XML
objects would handle cached or non cached files the same way, no?

Jim Kremens

On 6/26/06, Steven Sacks | BLITZ [EMAIL PROTECTED] wrote:


You're loading in a non-cached version each time right?

var myXml = new XML();
for (var a = 0; a  30; a++) {
   myXml.load(path + ?x= + a);
}


BLITZ | Steven Sacks - 310-551-0200 x209




___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] To script or not to script... flash animations and drawing

2006-06-27 Thread js

Hey Marcelo,

You really touched upon a subject that I have issues with as well.

Unfortunately, it seems that the vast majority of OOP supporters out 
there are code purists to extreme extents. While the organization and 
extensibility that OOP provides is very helpful under specific 
circumstances; it can also serve to actually regress your abilities.


It's very easy to get into a mental feedback-loop of over-designing. 
Not every little project you make is going to warrant a full blown OOP 
solution.


Personally I love experimenting with code and I more-than appreciate 
the all-code approach (I tend towards full-code implementations 
myself). However, I have a lot of experience with visual art and 
graphic design as well; many complex styles and aesthetics exist that 
cannot be executed as efficiently through mathematics and code alone.


To answer your question more directly: Yes. It's perfectly OK to build 
animation in the timeline.


The all-code purist mentality that seems to pervade the upper-echelon 
of flash developers is not universally justifiable in my opinion. I 
can't remember what site exactly, but I actually read a blog the other 
day where the author was advocating that Macromedia get rid of the 
timeline and provide Flash as a code-only platform. I think many of us 
forget that flash is actually a platform for _animation_, not just for 
snazzy form-based Rich Internet Applications. While Flash has 
evolved and its scope has broadened tremendously; old-fashion 
animation by hand is the only way to create certain effects. (And vice 
versa)


http://www.phppatterns.com/docs/design/hello_world_in_patterns
http://www.helpqlodhelp.com/blog/archives/000151.html
http://c2.com/cgi/wiki?DesignPatternsConsideredHarmful


You might find some interesting information in the above links.

Best Regards,
Joseph Sorensen

Marcelo de Moraes Serpa wrote:

I´m working on a new RIA project that requires colorfull and smooth
animations, some of them are linear, some of them I guess are better 
created
through scripting (random) -  and here´s where I often find myself 
confused:

I used to be a timeline guy, but then after I learned OOP, I always find
myself trying to implement EVERYTHING through scripts. I would like some
advice on:

- Is it okay to build some animations using the timeline?
- What tools do you use to boost your productivity with Flash
animation/drawing (plug-ins, etc)?

Lately I have only been using ZigoEngine and Fuse for animations and while
it´s awesome at what it does, some animations I´m designing now are too 
much

complex and linear to be done through scripting... but then, it´s hard to
accomplish some of the effects I can easily add with ZigoEngine using the
Flash IDE...

Any advices are welcome!

Marcelo.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com




--
--

*Joseph Sorensen* / *Skyform* ©
Web Design / Audio Production / Photography
*Web:* aerosdesign.com/jsorensen
*Em:* jsorensen[at]aerosdesign.com
*Ph:* 815.276.9006
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] UML + Actionscript

2006-06-19 Thread js
I have been trying to learn the basics of UML for the past couple days 
or so by assembling a class diagram for a hypothetical Contact 
Manager--although it may not stay hypothetical if I can learn this 
properly ;). Unfortunately I am experiencing a bit of confusion in 
regards to properly communicating class hierarchy between associated / 
aggregated classes.


Here is the (very simple) diagram that I made thus-far:

http://www.aerosdesign.com/jsorensen/store/uml/uml_diag_a.jpg

Basically, I have three classes -- the Account class being a 
composition of the Contact and Address classes. (I think)


Here is my question:

When I say that class X is a composition of class Y and class Z, is 
this because X has properties that are defined AS _TYPE_ Y and Z?


My logic to place the Contact class and the Address class as composing 
elements of the Account class is simply because the Contact class have 
defined properties OF TYPE Contact and Address. Is this correct?


If this is the case, I will be glad to hear that I am doing things 
correctly. However, a new source of confusion then emerges for me; 
say, for instance that I wanted to have an Array of contacts for any 
given account as opposed to just one. I then replace 
accContact:Contact with accContacts:Array.


Here is the updated diagram:
http://www.aerosdesign.com/jsorensen/store/uml/uml_diag_b.jpg

The relationship between the Contact class and the Account class is no 
longer explicit--but I still want to convey that the accContacts array 
will be populated with instances of Contact. How do I now 
communicate this relationship? Would this be an association now?


See this diagram if you are confused:

http://www.aerosdesign.com/jsorensen/store/uml/uml_diag_comment.jpg

A sincere thank you to anyone who took the time to read and attempt to 
understand my post; I apologize if this is slightly outside the scope 
of normal list discussion. If this is not an appropriate place to ask 
this sort of question, I would be very happy to hear about an active 
UML mailing list or equivalent alternative. :)


Thanks for any assistance,
Joseph
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] XML load within an object

2006-06-18 Thread js

import util.Proxy;

class Widget {

private var _someProperty:Number = 5;

public function Widget(xmlFile:String){

var xmlData:XML;

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = Proxy.create(this,init,xmlData);
xmlData.load(xmlFile);

}

private function init(success:Boolean, xmlData:XML){
trace(success);
trace(this._someProperty);
trace(xmlData);
}
}


You can get proxy from http://www.person13.com/articles/proxy/Proxy.htm

Alternatively (and not as cleanly):

class Widget {

private var _someProperty:Number = 5;

public function Widget(xmlFile:String){

var xmlData:XML;

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = function(success:Boolean){
ref.init(success,this);
}
xmlData.load(xmlFile);

}

private function init(success:Boolean, xmlData:XML){
trace(success);
trace(this._someProperty);
trace(xmlData);
}
}


onLoad dosen't take parameters -- it's being invoked by the XML
class from a private method and passed a boolean value so that you can
evaluate if the load was successful.
With = function(success:Boolean){..., you are assigning the onLoad
method an anonymous function so that when the method does eventually
get invoked after a successful load, your functionality is invoked as
well.

--

Joseph Sorensen


D_C wrote:

i have a UI widget that loads its own layout info from an XML file.

is there a way to set the xml.onLoad to a useful function?

I would like to have the xml.onLoad callback to initialize the object
itself, like this:

class MyWidget {
 function myWidget(xmlFile) { // constructor
   xmlData = new XML();
xmlData.load( xmlFile );
xmlData.onLoad = this.init(xmlData);  // doesnt work
 }
 function init(xmlData) {
   /// do layout stuff here
 }

}

it seems the xml.onLoad will only take a function with a single
boolean parameter? eg
 xmlData.onLoad = function(success)  {  // ...

is there another pattern for doing this?

thanks!

/dc
___
  David DC Collier

[EMAIL PROTECTED]
  skype: callto://d3ntaku
  http://www.pikkle.com
  +81 (0)80 6521 9559

http://charajam.com 【★キャラ♪ジャム★】
人気キャラとJ-POP最新ヒット曲を自分で組み合わせて
待受Flashや着Flashを作っちゃおう!
___
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com




--
--

*Joseph Sorensen* / *Skyform* ©
Web Design / Audio Production / Photography
*Web:* aerosdesign.com/jsorensen
*Em:* jsorensen[at]aerosdesign.com
*Ph:* 815.276.9006
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] XML load within an object

2006-06-18 Thread js

Yes, oops. It was late (early). :)

David Skoglund wrote:
In the not so clean version, I belive you would need to set the prop 
ref to this before loading.


Like this:

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.ref=this; 
xmlData.onLoad = function(success:Boolean){
   ref.init(success,this);
}

/David

- Original Message - From: js [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Sunday, June 18, 2006 12:54 PM
Subject: Re: [Flashcoders] XML load within an object



import util.Proxy;

class Widget {

private var _someProperty:Number = 5;

public function Widget(xmlFile:String){

var xmlData:XML;

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = Proxy.create(this,init,xmlData);
xmlData.load(xmlFile);

}

private function init(success:Boolean, xmlData:XML){
trace(success);
trace(this._someProperty);
trace(xmlData);
}
}


You can get proxy from http://www.person13.com/articles/proxy/Proxy.htm

Alternatively (and not as cleanly):

class Widget {

private var _someProperty:Number = 5;

public function Widget(xmlFile:String){

var xmlData:XML;

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = function(success:Boolean){
ref.init(success,this);
}
xmlData.load(xmlFile);

}

private function init(success:Boolean, xmlData:XML){
trace(success);
trace(this._someProperty);
trace(xmlData);
}
}


onLoad dosen't take parameters -- it's being invoked by the XML
class from a private method and passed a boolean value so that you can
evaluate if the load was successful.
With = function(success:Boolean){..., you are assigning the onLoad
method an anonymous function so that when the method does eventually
get invoked after a successful load, your functionality is invoked as
well.

--

Joseph Sorensen


D_C wrote:

i have a UI widget that loads its own layout info from an XML file.

is there a way to set the xml.onLoad to a useful function?

I would like to have the xml.onLoad callback to initialize the object
itself, like this:

class MyWidget {
 function myWidget(xmlFile) { // constructor
   xmlData = new XML();
xmlData.load( xmlFile );
xmlData.onLoad = this.init(xmlData);  // doesnt work
 }
 function init(xmlData) {
   /// do layout stuff here
 }

}

it seems the xml.onLoad will only take a function with a single
boolean parameter? eg
 xmlData.onLoad = function(success)  {  // ...

is there another pattern for doing this?

thanks!

/dc
___
  David DC Collier

[EMAIL PROTECTED]
  skype: callto://d3ntaku
  http://www.pikkle.com
  +81 (0)80 6521 9559

http://charajam.com 【★キャラ♪ジャム★】
人気キャラとJ-POP最新ヒット曲を自分で組み合わせて
待受Flashや着Flashを作っちゃおう!
___
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com




--
--

*Joseph Sorensen* / *Skyform* ©
Web Design / Audio Production / Photography
*Web:* aerosdesign.com/jsorensen
*Em:* jsorensen[at]aerosdesign.com
*Ph:* 815.276.9006
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com




--
--

*Joseph Sorensen* / *Skyform* ©
Web Design / Audio Production / Photography
*Web:* aerosdesign.com/jsorensen
*Em:* jsorensen[at]aerosdesign.com
*Ph:* 815.276.9006
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] The Delegate class ...

2006-06-14 Thread js
While not as elegant, you can get around this issue delegate-free with 
the following:


class SomeClass {

private var a:Number = 3;

function SomeClass(mc:MovieClip){

var thisObj = this;
// Set a reference to this

mc.onRelease = function(){

thisObj.onRelease.call(thisObj);
}

}

function onRelease(){

trace(this.a: +this.a);

}
}

--

Joseph

James Marsden wrote:

The delegate class is a godsend for so many things...


// inside a class:

mc.onEnterFrame = mx.utils.Delegate.create(this, main);

function main()
{
   // the mc is calling my method, and I can access all my properties as 
if I was calling it myself

}




Stephen Ford wrote:


Hello All,

Can anyone confirm that the Delegate class is only helpful when using 
components ?


Or should it also be used for events outside the component framework ?

No doubt it depends on what your trying to achieve, but just generally 
speaking, what do you think.


Thanks,
Stephen.
 


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] The Delegate class ...

2006-06-14 Thread js
Absolutely nothing. I have no idea why I put call there. :) I use call 
 a fair amount to manipulate scope and I think I just typed it out of 
habit.


Joseph

Aaron Buchanan wrote:

What is the difference between that and this:

class SomeClass {

private var a:Number = 3;

function SomeClass(mc:MovieClip){

var thisObj = this;

// Set a reference to this

mc.onRelease = function(){

thisObj.onRelease();
}

}


function onRelease(){

trace(this.a: +this.a);

}

}


On 6/14/06 1:39 PM, js [EMAIL PROTECTED] wrote:


While not as elegant, you can get around this issue delegate-free with
the following:

class SomeClass {

private var a:Number = 3;

function SomeClass(mc:MovieClip){

var thisObj = this;
// Set a reference to this

mc.onRelease = function(){

thisObj.onRelease.call(thisObj);
}

}

function onRelease(){

trace(this.a: +this.a);

}
}

--

Joseph

James Marsden wrote:

The delegate class is a godsend for so many things...


// inside a class:

mc.onEnterFrame = mx.utils.Delegate.create(this, main);

function main()
{
   // the mc is calling my method, and I can access all my properties as
if I was calling it myself
}




Stephen Ford wrote:


Hello All,

Can anyone confirm that the Delegate class is only helpful when using
components ?

Or should it also be used for events outside the component framework ?

No doubt it depends on what your trying to achieve, but just generally
speaking, what do you think.

Thanks,
Stephen.
 


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] gotoAndPlay and onLoad

2006-06-12 Thread js
This is the most weird thing I've run into all week... I don't work 
much with actual animation on the timeline, most of my flash work is 
done through pure AS, so I have not yet run into this issue:


1. Create a movie clip on the stage with an instance name of my_mc 
and place a stop command on frame 1 of that movie clip.


2. Create a small random tween from frames 2 through whatever in my_mc.

3. Go to frame one on the main timeline and type:

stop();
my_mc.gotoAndPlay(2);

The movie clip does not start playing on frame 2, it just merely stops 
on frame 2. What the heck?!


Secondly, if I do:

my_mc.onLoad = function(){
trace(Loaded!);
}

I get nothing when I test. Why?!

F1 has this to say about onLoad: Invoked when the movie clip is 
instantiated and appears in the timeline. You must define a function 
that executes when the event handler is invoked. You can define the 
function on the timeline or in a class file that extends the MovieClip 
class or is linked to a symbol in the library.


...I'm so confused.

--

*Joseph Sorensen* / *Skyform* ©
Web Design / Audio Production / Photography
*Web:* aerosdesign.com/jsorensen
*Em:* jsorensen[at]aerosdesign.com
*Ph:* 815.276.9006
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Regarding ascb Proxy

2006-06-09 Thread js
Thank you for this excellent enhanced version erixtekila. Just read 
through the blog post on http://dynamicflash.com/ and it was also a 
good read. He actually updated the class if you didn't notice--you can 
find it here: http://dynamicflash.com/classes/Delegate.as



erixtekila wrote:

Hi,



I have slightly modify the Joey's version.
I use also the Array.slice which is faster than the loop.

For the last arguments, it's a mean to get a reference added as a end 
param to the callback handler.

Easier to dereference after.

Note the return at the end of the functions.
French comments for inside for more insights.

//!-- UTF8
/*
-
Proxy

package : com.person13.ascb.util

Description :
Sert d'intermédiaire pour la délégation de référence de fonction.
Cas d'un callback avec nécessité de portée spécifiqye.
-
   ##++
   ##Copyright (c) 2005
   ##http://www.v-i-a.net
   ##All Rights Reserved
   ##
   ##E-Mail: [EMAIL PROTECTED]
   ##
   ##Permission to use, copy, modify and distribute is hereby granted,
   ##providing that no charges are involved and the above  copyright
   ##notice and this permission appear in all copies and in supporting
   ##documentation. Requests for other distribution rights, including
   ##incorporation in commercial  products,  such as  books,  magazine
   ##articles, or CD-ROMS should be made to the authors.
   ##
   ##This  program  is distributed in the hope that it will be useful,
   ##but WITHOUT ANY WARRANTY;  without  even  the implied warranty of
   ##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   ##--

   For complete Licence of the Creative Commons
   Attribution-NonCommercial-ShareAlike 2.0
   See : http://creativecommons.org/licenses/by-nc-sa/2.0/
-
version history :
1.0 : 17 juin 2005
- Reprise du code de Joey Lott
1.1 : 04 juillet 2005
- Rajout d'un retour pour les fonctions procurées.
- Rajout d'un nouvel argument pour déréférencer le 
proxy

par la suite.
-

/**
 *Utile pour créer une référence de callback.
 *- pour un observateur sur une fonction (listener function)
 *- pour un callback d'un classe composant une autre classe
 *
 *La fonction callback recevra une référence à la fonction Proxy en 
dernier paramètre.
 *Il est ainsi possible d'utiliser EventSource.removeEventListener 
(EventName, ProxyRef)

 *et de supprimer la référenec au proxy.
 *
 *@authorJoey Lott http://www.person13.com
 *@author erixtekila copyleft http://www.v-i-a.net
 *@version 1.1
 */
class com.person13.ascb.util.Proxy
{
/**
 *Méthode factory pour appliquer une référence à un callback
 *Note : Le dernier paramètre envoyé à la méthode proxiée et une 
référence au proxy.

 *Ainsi, depuis celle-ci il est possible de le déréférencer.
 *cf http://dynamicflash.com/2005/02/delegate-class-refined
 *   
 *@param oTargetObjet cible du callback.

 *@param fFunctionCallback.
 *@return Une référence à la fonction Proxy
 */
public static function create (oTarget:Object, 
fFunction:Function):Function

{
/* Modifié de l'original
var aParameters:Array = new Array();
for(var i:Number = 2; i  arguments.length; i++) {
aParameters[i - 2] = arguments[i];
}*/
// Paramètres à passer au callback
var aParameters:Array;
aParameters = arguments.splice (2);
   
// EventProxy, référence à une fonction

var fProxy:Function = function ():Object
{
// Paramètres
var aActualParameters:Array = arguments.concat (aParameters);
// Rajout de la référence au Proxy à la fin des paramètres
/**
 * Permet de déréférencer la proxy depuis la fonction soumise
 * Exemple : cf 
http://dynamicflash.com/2005/02/delegate-class-refined

 *
 * public function DFDelegateTest(textArea:TextArea) {
 * _textArea = textArea;
 *_textArea.addEventListener(change, 
Delegate.create(this, onTextAreaChange));

 *}
 *
 *private function onTextAreaChange(event:Object, 
delegate:Function) : Void {

 *_textArea.removeEventListener(change, delegate);
 *}
 */
aActualParameters.push (arguments.callee);
// Activation
// Rajout d'un return pour correspondre au fonctionnement de 
mx.util.Delegate.

return fFunction.apply (oTarget, 

[Flashcoders] Test Post

2006-06-08 Thread js

Test post, please disregard!
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Regarding ascb Proxy

2006-06-08 Thread js
I was taking a look recently at the Proxy class created by Joey Lott of 
Person13 for educational purposes, as I have just started learning OOP, 
and a couple questions popped into my mind.


Here is the full class:

class ascb.util.Proxy {

 public static function create(oTarget:Object, 
fFunction:Function):Function {


   var aParameters:Array = new Array();

   for(var i:Number = 2; i  arguments.length; i++) {
 aParameters[i - 2] = arguments[i];
   }

   var fProxy:Function = function():Void {

 var aActualParameters:Array = arguments.concat(aParameters);
 fFunction.apply(oTarget, aActualParameters);

   };

   return fProxy;

 }

}

First of all, when populating aParameters, why couldn't you just do:

aParameters = arguments.slice(2);

That seems a lot more clean and improves readability a bit, no?

Second, why exactly do you need to concat the arguments of fProxy and 
aParameters? I can see what it's doing; it's tacking on the additional 
arguments supplied to Proxy.create onto the arguments of the fProxy 
function (which is then returned) -- but I can't really envision a 
situation where that would be needed? For instance:


class someClass {

   private var _someMc:MovieClip;

   function someClass(mc:MovieClip){

   _someMc = mc;

   _someMc.onRelease = Proxy.create(this,someMethod,1,2,3);

   }

   private function someMethod(a,b,c){

  trace(a+ +b+ +c);

   }

}

In what case would I be calling someMethod() via Proxy and supplying a 
set of arguments that do not match the syntax of someMethod()? It seems 
to me that you could just replace the following:


var aActualParameters:Array = arguments.concat(aParameters);
fFunction.apply(oTarget, aActualParameters);

with:

fFunction.apply(oTarget, aParameters);

Any clarification or insight is greatly appreciated.

Joseph Sorensen
aerosdesign.com/jsorensen
jsorensen[at]aerosdesign.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com