Re: [Flashcoders] Modifying movieclip property kills tween

2008-07-31 Thread Boon Chew

Thanks Zeh & Helmut for enlightening me on this.

- boon

--- On Thu, 7/31/08, Zeh Fernando <[EMAIL PROTECTED]> wrote:
From: Zeh Fernando <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] Modifying movieclip property kills tween
To: "Flash Coders List" 
Date: Thursday, July 31, 2008, 7:15 AM

Whether it "makes sense" or not, Helmut is right and this is how it 
works. Changing the value of a property dynamically via code /detaches/ 
it from any tweening applied by the timeline. The ideal solution is have 
a container inside of it. Or, really, don't use the timeline tweening at 
all.

Zeh

Boon Chew wrote:
>  
> Hmm, this doesn't make sense.  The property of an object should be
allowed to change since it's not changed during an actual tween.  Also, the
property involved is not what's being tweened, so why would it nullify a
tween done on it at a different time?
>  
> - boon
> 
> --- On Wed, 7/30/08, Helmut Granda <[EMAIL PROTECTED]> wrote:
> 
> From: Helmut Granda <[EMAIL PROTECTED]>
> Subject: Re: [Flashcoders] Modifying movieclip property kills tween
> To: "Flash Coders List"

> Date: Wednesday, July 30, 2008, 1:49 PM
> 
> This is the proper behavior since you are overriding the properties of the
> object itself. Such as if you were overriding the x, y, scale properties.
> You can wrap the object into a container and edit the properties of the
> container that then will be reflected into its child, in this case the
> "box".
> 
> 
> On Wed, Jul 30, 2008 at 2:13 PM, Boon Chew <[EMAIL PROTECTED]>
wrote:
> 
>> Hi all, I ran into something strange whereby if I modify a
movieclip's
>> property (say alpha), it would kill the tween that will take place
later
>> that involves the movieclip.  Wonder if anyone has run into this?
>>
>> 1) In a test FLA, create a movieclip called "test".  Inside
> "test", create
>> two frames, "start" on frame 2 and "end" on
whatever
> (say frame 30).
>> 2) Put a movieclip called "box" on timeline and tween it
from
> "start" to
>> "end".
>> 3) In the main timeline, add this:
>> stage.addEventListener(MouseEvent.MOUSE_DOWN, click);
>>
>> function click(event:MouseEvent):void
>> {
>> test.box.alpha = 1;  // <-- changing alpha value causes the
tween
> to
>> stop working, comment this out and tween works
>> test.gotoAndPlay("start");  // tween test.box by moving
it
> across the
>> stage
>> }
>>
>>
>> - boon
>>
>>
>>
>>
>> ___
>> 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


Re: [Flashcoders] Modifying movieclip property kills tween

2008-07-30 Thread Boon Chew
 
Hmm, this doesn't make sense.  The property of an object should be allowed to 
change since it's not changed during an actual tween.  Also, the property 
involved is not what's being tweened, so why would it nullify a tween done on 
it at a different time?
 
- boon

--- On Wed, 7/30/08, Helmut Granda <[EMAIL PROTECTED]> wrote:

From: Helmut Granda <[EMAIL PROTECTED]>
Subject: Re: [Flashcoders] Modifying movieclip property kills tween
To: "Flash Coders List" 
Date: Wednesday, July 30, 2008, 1:49 PM

This is the proper behavior since you are overriding the properties of the
object itself. Such as if you were overriding the x, y, scale properties.
You can wrap the object into a container and edit the properties of the
container that then will be reflected into its child, in this case the
"box".


On Wed, Jul 30, 2008 at 2:13 PM, Boon Chew <[EMAIL PROTECTED]> wrote:

> Hi all, I ran into something strange whereby if I modify a movieclip's
> property (say alpha), it would kill the tween that will take place later
> that involves the movieclip.  Wonder if anyone has run into this?
>
> 1) In a test FLA, create a movieclip called "test".  Inside
"test", create
> two frames, "start" on frame 2 and "end" on whatever
(say frame 30).
> 2) Put a movieclip called "box" on timeline and tween it from
"start" to
> "end".
> 3) In the main timeline, add this:
> stage.addEventListener(MouseEvent.MOUSE_DOWN, click);
>
> function click(event:MouseEvent):void
> {
> test.box.alpha = 1;  // <-- changing alpha value causes the tween
to
> stop working, comment this out and tween works
> test.gotoAndPlay("start");  // tween test.box by moving it
across the
> stage
> }
>
>
> - boon
>
>
>
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
...helmut
___
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] Modifying movieclip property kills tween

2008-07-30 Thread Boon Chew
Hi all, I ran into something strange whereby if I modify a movieclip's property 
(say alpha), it would kill the tween that will take place later that involves 
the movieclip.  Wonder if anyone has run into this?

1) In a test FLA, create a movieclip called "test".  Inside "test", create two 
frames, "start" on frame 2 and "end" on whatever (say frame 30).
2) Put a movieclip called "box" on timeline and tween it from "start" to "end".
3) In the main timeline, add this:
stage.addEventListener(MouseEvent.MOUSE_DOWN, click);

function click(event:MouseEvent):void
{
    test.box.alpha = 1;  // <-- changing alpha value causes the tween to stop 
working, comment this out and tween works
    test.gotoAndPlay("start");  // tween test.box by moving it across the stage
}


- boon




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


Re: [Flashcoders] triangle help

2007-01-26 Thread Boon Chew
Law of Sines will solve your problem.

http://en.wikipedia.org/wiki/Law_of_sines

Jason Rayles <[EMAIL PROTECTED]> wrote: Given the interior angles and the 
length of one side (not the hypoteneuse) 
of a right triangle, how do I calculate (in Flash) the length of the other 2 
sides?

Thanks,
Jason 

___
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


 
-
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.
___
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] DHTML menu rolling over on top of flash possible?

2006-12-12 Thread Boon Chew
Haha, of all places.  Good one, you rock!

Jim Robson <[EMAIL PROTECTED]> wrote: I think you can see an example here: 
http://www.adobe.com/
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Boon Chew
Sent: Tuesday, December 12, 2006 7:14 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] DHTML menu rolling over on top of flash possible?

Hi all, my coworker asked me this question that stumped me.  Hopefully one
of you can help us out? :)

The question is, is it possible for the browser to render a dropdown menu
(done in CSS/DHTML) that is positioned right on top of a flash banner.  That
is, you would see the dropdown coming down on top of the flash banner when
rolling over the menu.

Thanks!

 
-
Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.
___
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



-
Everyone is raving about the all-new Yahoo! Mail beta.
___
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] DHTML menu rolling over on top of flash possible?

2006-12-12 Thread Boon Chew
Hi all, my coworker asked me this question that stumped me.  Hopefully one of 
you can help us out? :)

The question is, is it possible for the browser to render a dropdown menu (done 
in CSS/DHTML) that is positioned right on top of a flash banner.  That is, you 
would see the dropdown coming down on top of the flash banner when rolling over 
the menu.

Thanks!

 
-
Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.
___
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] perspective texture mapping

2006-11-29 Thread Boon Chew

I am investigating the different ways one can implement or simulate perspective 
texture mapping both using Flash 8 API (e.g. with bitmapdata) and without using 
Flash 8 API (without bitmapdata, how?).

Anyone with experience in this or knows of any resources exploring this topic?


 
-
Check out the all-new Yahoo! Mail beta - Fire up a more powerful email and get 
things done faster.
___
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] looking for win app to parse SWF header

2006-11-22 Thread Boon Chew
Does any of you know of a good simple swf header parser out there that works on 
Windoze?

Looking for a quick way to obtain the swf frame size (height, width), frame 
rate, etc.

Thanks.

 
-
Sponsored Link

Mortgage rates near 39yr lows. $510,000 Mortgage for $1,698/mo -   Calculate 
new house payment
___
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] brain teaser: filter tweening code has a problem, can you spot it?

2006-10-11 Thread Boon Chew

Actually the function will remember what the temp variable points to even after 
everything goes out of scope through the so-called closure.  So change is scope 
is not necessary for this teaser's fix.

- Original Message 
From: Steven Sacks | BLITZ <[EMAIL PROTECTED]>
To: Flashcoders mailing list 
Sent: Wednesday, October 11, 2006 11:50:13 AM
Subject: RE: [Flashcoders] brain teaser: filter tweening code has a problem, 
can you spot it?

You've got a scope issue.  The movieclip has no idea what gfBX or gfBY
is on rollover because they are just temporary variables in your
iterator and once your iterator is done they're gone and the movieclip
has no reference to them.  You need to assign gfBX and gfBY to the
movieclip so it knows what they are.

mc.gfBX = gfBX;

mc.onRollOver = function() {
this.gfBX.continueTo(30, 2);
};

Follow?

HTH,
Steven

___
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] brain teaser: filter tweening code has a problem, can you spot it?

2006-10-11 Thread Boon Chew
Hi all,

I downloaded a piece of filter tweening code, modified it (added loop around 
it) to tween mutiple clips on stage with the name (kText0, kText1, etc.) and 
for some reason it only tweens the last clip.

After some debugging I found out where the problem lies.  But when I compiled 
the code in my head, everything seemed fine (probably have a buggy brain).  Can 
you spot what the problem is from the code below?  How would you fix it?

import mx.transitions.Tween;
import mx.transitions.easing.*;
import flash.filters.GlowFilter;

for (var i = 0; i < 5; ++i)
{
var mc = this["kText" + i];
var gf:GlowFilter = new GlowFilter(0x356D83, 100, 5, 5, 5, 3, false, false);
var gfBX:Tween = new Tween(gf, "blurX", Elastic.easeOut, 5, 5, 1, true);
var gfBY:Tween = new Tween(gf, "blurY", Elastic.easeOut, 5, 5, 1, true);
mc.onRollOver = function() {
gfBX.continueTo(30, 2);
gfBY.continueTo(30, 2);
};
mc.onRollOut = function() {
gfBX.continueTo(5, 2);
gfBY.continueTo(5, 2);
};

gfBX.onMotionChanged = function() {
mc.filters = [gf];
};
}



___
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] Job Offer

2006-08-30 Thread Boon Chew
Guys, sorry for the spam, didn't realize the reply address was the whole 
mailing list... -.-;

- boon

Rutul Patel <[EMAIL PROTECTED]> wrote: Hi Guys,
My name is Rutul. I am currently working on one flash Project.
I am the only person who is currently working on this project.
So that My company needs one consultant who can work part-time
or weekends or even flexible hours.

so if anybody interesting in this offer mail me on
[EMAIL PROTECTED] . or if you know anybody who can
work, give me his/her contact information.

we are located at woodbridge, NJ.

Thank you,
Rutul Patel
___
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



-
Do you Yahoo!?
 Everyone is raving about the  all-new Yahoo! Mail.
___
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] Job Offer

2006-08-30 Thread Boon Chew
Hi Rutul, my name is Boon.  Are you still looking for help on this?  I have 
worked on projects with major clients such as Nintendo, Microsoft and Hasbro, 
let me know if you are still looking for help and I will forward you my resume.

- boon

Rutul Patel <[EMAIL PROTECTED]> wrote: Hi Guys,
My name is Rutul. I am currently working on one flash Project.
I am the only person who is currently working on this project.
So that My company needs one consultant who can work part-time
or weekends or even flexible hours.

so if anybody interesting in this offer mail me on
[EMAIL PROTECTED] . or if you know anybody who can
work, give me his/her contact information.

we are located at woodbridge, NJ.

Thank you,
Rutul Patel
___
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



-
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ 
countries) for 2¢/min or less.
___
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] Weird getURL behavior

2006-08-01 Thread Boon Chew
Did you check your webserver's access log and see what you get when getURL( ) 
runs?

Another quick test is to change your .doc extension to .html and see what 
happen.  Maybe your webserver is configured not to serve that file type? 
(doesn't seem like it since you can get it when you try it at the address bar)

Test it on Firefox too and see what happen...

- boon

"Merrill, Jason" <[EMAIL PROTECTED]> wrote: Let me add, this only happens on my 
machine, not my co-workers - my
co-workers have the identical push of SP2 for the OS and IE, and the
same internet browser settings.  As well as the same list of trusted
sites. Any ideas anyone?

Jason Merrill
Bank of America 
Learning & Organization Effectiveness - Technology Solutions 
 

>>-Original Message-
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Merrill, Jason
>>Sent: Tuesday, August 01, 2006 11:27 AM
>>To: Flashcoders mailing list
>>Subject: [Flashcoders] Weird getURL behavior
>>
>>I'm going crazy with this. Hopefully, I'm just missing something
stupid.
>>
>>
>>Weird getURL behavior in my Flash 8 player.  Is there any reason why a
>>Flash file here:
>>
>>http://loerepository/evaluationGallery/myFlashFile.swf
>>
>>Would not be able to link to this:
>>
>>http://loerepository/evaluationGallery/EARS_L3_Interview.doc
>>
>>
>>
>>Same domain, same folder!  Ah, this is so freaking aggravating.  It
was
>>working fine just a week ago.  We did recently move the flash file and
>>the linked-to doc to a new server... is there something about a URL
that
>>doesn't have www.mypage.com in it?  I didn't think so... so anyway I
am
>>just using:
>>
>>getURL("EARS_L3_Interview.doc", "_blank");
>>
>>or, I also tried the absolute path:
>>
>>getURL("http://loerepository/evaluationGallery/EARS_L3_Interview.doc";,
>>"_blank");
>>
>>(note, don't try that paths above, it's on an intranet site and will
>>fail for you)
>>
>>it does pop up a new window, but the window says,
>>
>>"Action canceled
>>Internet Explorer was unable to link to the Web page you requested.
The
>>page might be temporarily unavailable."
>>
>>HOWEVER, the file IS there and available:  if I put the path to the
>>browser address bar directly, it works fine!!!  What's up with that?
>>Why would getURL only fail in Flash?  My worst fear is there is some
>>security thing on the server the admins changed which is blocking my
>>access from Flash.  Ideas?
>>
>>
>>Jason Merrill
>>Bank of America
>>Learning & Organization Effectiveness - Technology Solutions
>>
>>
>>
>>
>>
>>
>>___
>>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



-
Do you Yahoo!?
 Next-gen email? Have it all with the  all-new Yahoo! Mail Beta.
___
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] extending flash with c++?, watching files as they are updated

2006-07-18 Thread Boon Chew

Is the file you want to watch residing on the client's machine or on the server?


aaron smith <[EMAIL PROTECTED]> wrote: I need to find a solution to a problem. 
I have a couple different 
options so far.

the problem:
I need to be able to execute some flash commands when a file is changed. 
( needs to be as close to real-time as possible ). The file is a basic 
log file.

possible solutions:
-Now what i'm wondering is if it's possible to use c++ to extend flash 
and add some sort of file watching object. so have c++ be watching the 
file, and as it's being written to be notifying another object in flash 
of the change.

-python, socket server.


any recommendations or help in the right direction would be appreciated.
thanks



___
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



-
Yahoo! Music Unlimited - Access over 1 million songs.Try it free. 
___
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] Using Korean or Chinese text in textfields

2006-05-19 Thread Boon Chew
What specifically are you looking for?  Using Korean text or Chinese text 
should be no different than using regular text, except that you need to make 
sure the textfield is set to use Unicode fonts so your text will appear 
properly.


Jim Kremens <[EMAIL PROTECTED]> wrote: Hi all,

Does anyone have any examples they can share of using Korean or Chinese text
in textfields?

Thanks,

Jim Kremens
___
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



-
Sneak preview the  all-new Yahoo.com. It's not radically different. Just 
radically better. 

-
Ring'em or ping'em. Make  PC-to-phone calls as low as 1¢/min with Yahoo! 
Messenger with Voice.
___
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] when is a new line not a new line?

2006-05-19 Thread Boon Chew

You should figure it what's exactly in the string first by looping through your 
string and take it from there.

You can print out the character code using String.charCodeAt(i) to see if you 
are really getting 13/10.

Tom Rhodes <[EMAIL PROTECTED]> wrote: hello all,

i'm getting xml data via http, this is being formatted as actionscript 
objects using sepiroths XML2Object class, now, when i try and split some 
of this data on "\n" it doesn't work, neither does "\r". now the guy who 
has done the backend stuff in his asp code uses vbCrLf to put in the 
breaks, which is ascii 10 or 13, the same as \r or \n.

anyone know whats happening here?



___
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



-
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates 
starting at 1¢/min.

-
Sneak preview the  all-new Yahoo.com. It's not radically different. Just 
radically better. 
___
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] Using EventDispatcher in AS 1.0 code

2006-04-17 Thread Boon Chew
I can't really compile it using the AS 2.0 setting.  The code base is huge and 
it would create a lot of compiler errors and ripple effects throughout the 
system.  Alas, compiling it strictly with AS 1.0 is the requirement here.


Randy Troppmann <[EMAIL PROTECTED]> wrote: I am a big fan of EventDispatcher! 
If you are using Flash MX2004 or
later you can use AS2.0 (class based or not) to code. It all compiles
down to AS1 code within the swf when you publish. You can set the
target flash player in publish settings to an earlier version to
accomodate the most users (Flash 8 player sits around 60% acceptance
at this time I believe). Some new features and classes are not
backwards compatible, and Flash will warn you of these when you
publish. You are safe if you want to write your application using an
AS2.0 class based framework and publish back to Flash 6 compatibility.
This includes EventDispatcher.

Randy Troppmann


On 4/17/06, Boon Chew  wrote:
> Hi all, I recently have had to work on some AS1.0 code (a requirement is that 
> the code must be published with AS 1.0 compiler).  Since EventDispatcher is 
> not available in AS 1.0, I modified mx.events.EventDispatcher to work with in 
> AS 1.0 mode, and make EventDispatcher available in global namespace, since 
> it's not intrinsic like AsBroadcaster is.  I have been able to use 
> EventDispatcher like I can in 2.0.  Curious though, is there any downside or 
> potential caveat to using EventDispatcher in strictly AS 1.0 that I should be 
> aware of?
>
> Thanks much.
>
>
>
>
>
>
>
> -
> Blab-away for as little as 1¢/min. Make  PC-to-Phone Calls using Yahoo! 
> Messenger with Voice.
> ___
> 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



-
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
___
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] Using EventDispatcher in AS 1.0 code

2006-04-17 Thread Boon Chew
Hi all, I recently have had to work on some AS1.0 code (a requirement is that 
the code must be published with AS 1.0 compiler).  Since EventDispatcher is not 
available in AS 1.0, I modified mx.events.EventDispatcher to work with in AS 
1.0 mode, and make EventDispatcher available in global namespace, since it's 
not intrinsic like AsBroadcaster is.  I have been able to use EventDispatcher 
like I can in 2.0.  Curious though, is there any downside or potential caveat 
to using EventDispatcher in strictly AS 1.0 that I should be aware of?

Thanks much.







-
Blab-away for as little as 1¢/min. Make  PC-to-Phone Calls using Yahoo! 
Messenger with Voice.
___
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] Need help understanding EventDispatcher

2006-04-12 Thread Boon Chew

 With event dispatching, multiple objects can register themselves to listen to 
the event. With the way below, there is no way multiple objects can react to 
onBallPress as you cannot do delegate chaining in Actionscript.


Patrick Matte <[EMAIL PROTECTED]> wrote: I dont see exactly why use for the 
event dispatcher.
Wouldn't this be good as well ?


// on timeline

import Ball2.as;
import mx.utils.Delegate;

var myBall:Ball2 = new Ball2();

myBall.onBallPress = Delegate.create(this,onBallPress);
myBall.addEvents();

function onBallPress():Void {
 trace("onBallPress");
}


// ball class

import mx.utils.Delegate;
class Ball2 {

 public var onBallPress:Function;
 private var aBall:MovieClip;

 public function Ball2 () {
  // create a ball MC
  aBall = 
_level0.createEmptyMovieClip('testBall',_level0.getNextHighestDepth()  );

  // draw ball
  aBall._x = 100;
  aBall._y = 100;
  aBall.lineStyle(20, 0xff, 100);
  aBall.lineTo(0,.2);
 }

 public function addEvents():Void{
  aBall.onPress = Delegate.create(this,onBallPress);
 }

}

___
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



-
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.

-
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
___
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] Lookup tables

2006-04-09 Thread Boon Chew
Check out some of the articles in Game Programming Gems vol. 2 has an article 
that deals with floating point op in general, and specifically on fast 
cosine/sine using LUT.  But the code implementation is in C, so they will not 
readily lend themselves to a direct port to AS.  It pays to understand how 
cosine/sine is implemented natively before doing it though.

- boon

Andreas R�nning <[EMAIL PROTECTED]> wrote: Anyone know of good online 
tutorials or treatments on generating and 
using lookup tables to speed up sin/cos and similar math in AS2?
I'm looking for ways to reuse the results of a single calculation across 
a number of variations of the calculated problem.

Yes this is game related :) Shoot-em-up related to be specific. Flash 
doesn't lend itself well to bullet storms it would seem.

- Andreas
___
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



-
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates 
starting at 1¢/min.

-
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates 
starting at 1¢/min.
___
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] createEmptyMovieClip path

2006-04-07 Thread Boon Chew
Does the code I attached work for you?  Or you can send me what you got, I can 
have a look.  It's Friday evening after all, and I am playing with code 
anyways. :)

- boon

hbruyere <[EMAIL PROTECTED]> wrote: Ok

I mc instance on the stage (scene) is correctly named.

I'm compiling the movie in Flash7 AS2.0 .. but I just tried in Flash8 AS2.0
and this is still not working.

Hum... what's going on. I never had this king of problem before.
I'm going to check everything... but it doesn't make sense...
I'm sure that I'm going to be mad at myself when I'm going to solve this.

I will let you know.

Thanks again, in the meantime if you any other idea...

Hugues.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Boon Chew
Sent: Saturday, April 08, 2006 12:17 AM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] createEmptyMovieClip path

Did a quick test, works fine.  Maybe compare the solution and figure out
where your problem is?

(I have an empty movieclip instance on stage called mcEmpty, did you name
your movie instance in your Properties window?)

Below code tested on Flash 8:

var url = [ "http://www.adobe.com/imageshome/flash_icon3.jpg";,
   "http://www.adobe.com/imageshome/pdfprintengine_icon.gif"; ];

for (var i = 0; i < url.length; i++)
{
// you can just create one MovieClipLoader to load all clips, but this
is ok too
var mcLoader:MovieClipLoader = new MovieClipLoader();

var mcHolder = mcEmpty.createEmptyMovieClip("mcHolder" + i,
mcEmpty.getNextHighestDepth());
mcHolder._x = 40 * i;
mcLoader.loadClip(url[i], mcHolder);
}

hbruyere  wrote: No didn't solve my problem.
But thanks.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Boon Chew
Sent: Friday, April 07, 2006 11:38 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] createEmptyMovieClip path


At a glance, I caught at least one problem, not sure if they are others that
could cause your problem.


var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
getNextHighestDepth());
You need to call getNextHighestDepth() on your ContentContainer_mc, like so:

var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
ContentContainer_mc.getNextHighestDepth()); 

- boon

 hbruyere  wrote: Hi,

 

I don't understand what I get when running this:

 




 

for (var i = 0; i < NumPages_v; i ++)

{

var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
getNextHighestDepth());

NewMC_mc._x = ScreenWidth_c * i;

NewMC_mc._y = 0;

var mcLoader:MovieClipLoader = new
MovieClipLoader();

mcLoader.addListener(this);

mcLoader.loadClip(WebsiteMap_a[i].File_tx,
NewMC_mc);

 

function onLoadInit(mc:MovieClip) {

trace("onLoadInit: " + mc);

}

 

 

}




 

I get NOTHING ! My external movieClips are not load or at least displayed.

 

But if If replace:

var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
getNextHighestDepth());

 

by

 

var NewMC_mc:MovieClip = createEmptyMovieClip("container"+i,
getNextHighestDepth());

 

it works.

 

But I want to load my external into the movie clip named
"ContentContainer_mc" present on the main scene on the root of my main
Movie.

 

What am I missing here ?

Must be stupid.

 

Any advice are welcome,

 

Thanks,

 

Hugues.

 

___
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


  
-
New Yahoo! Messenger with Voice. Call regular phones from your PC and save
big.
  
-
New Yahoo! Messenger with Voice. Call regular phones from your PC and save
big.
  
-
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
countries) for 2�/min or less.
___
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

RE: [Flashcoders] createEmptyMovieClip path

2006-04-07 Thread Boon Chew
Did a quick test, works fine.  Maybe compare the solution and figure out where 
your problem is?

(I have an empty movieclip instance on stage called mcEmpty, did you name your 
movie instance in your Properties window?)

Below code tested on Flash 8:

var url = [ "http://www.adobe.com/imageshome/flash_icon3.jpg";,
   "http://www.adobe.com/imageshome/pdfprintengine_icon.gif"; ];

for (var i = 0; i < url.length; i++)
{
// you can just create one MovieClipLoader to load all clips, but this is 
ok too
var mcLoader:MovieClipLoader = new MovieClipLoader();

var mcHolder = mcEmpty.createEmptyMovieClip("mcHolder" + i, 
mcEmpty.getNextHighestDepth());
mcHolder._x = 40 * i;
mcLoader.loadClip(url[i], mcHolder);
}

hbruyere <[EMAIL PROTECTED]> wrote: No didn't solve my problem.
But thanks.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Boon Chew
Sent: Friday, April 07, 2006 11:38 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] createEmptyMovieClip path


At a glance, I caught at least one problem, not sure if they are others that
could cause your problem.


var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
getNextHighestDepth());
You need to call getNextHighestDepth() on your ContentContainer_mc, like so:

var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
ContentContainer_mc.getNextHighestDepth()); 

- boon

 hbruyere  wrote: Hi,

 

I don't understand what I get when running this:

 




 

for (var i = 0; i < NumPages_v; i ++)

{

var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
getNextHighestDepth());

NewMC_mc._x = ScreenWidth_c * i;

NewMC_mc._y = 0;

var mcLoader:MovieClipLoader = new
MovieClipLoader();

mcLoader.addListener(this);

mcLoader.loadClip(WebsiteMap_a[i].File_tx,
NewMC_mc);

 

function onLoadInit(mc:MovieClip) {

trace("onLoadInit: " + mc);

}

 

 

}




 

I get NOTHING ! My external movieClips are not load or at least displayed.

 

But if If replace:

var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
getNextHighestDepth());

 

by

 

var NewMC_mc:MovieClip = createEmptyMovieClip("container"+i,
getNextHighestDepth());

 

it works.

 

But I want to load my external into the movie clip named
"ContentContainer_mc" present on the main scene on the root of my main
Movie.

 

What am I missing here ?

Must be stupid.

 

Any advice are welcome,

 

Thanks,

 

Hugues.

 

___
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


  
-
New Yahoo! Messenger with Voice. Call regular phones from your PC and save
big.
  
-
New Yahoo! Messenger with Voice. Call regular phones from your PC and save
big.
  
-
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
countries) for 2�/min or less.
___
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



-
Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2�/min 
with Yahoo! Messenger with Voice.

-
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ 
countries) for 2¢/min or less.
___
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] createEmptyMovieClip path

2006-04-07 Thread Boon Chew

At a glance, I caught at least one problem, not sure if they are others that 
could cause your problem.


var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
getNextHighestDepth());
You need to call getNextHighestDepth() on your ContentContainer_mc, like so:

var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
ContentContainer_mc.getNextHighestDepth()); 

- boon

 hbruyere <[EMAIL PROTECTED]> wrote: Hi,

 

I don't understand what I get when running this:

 




 

for (var i = 0; i < NumPages_v; i ++)

{

var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
getNextHighestDepth());

NewMC_mc._x = ScreenWidth_c * i;

NewMC_mc._y = 0;

var mcLoader:MovieClipLoader = new
MovieClipLoader();

mcLoader.addListener(this);

mcLoader.loadClip(WebsiteMap_a[i].File_tx,
NewMC_mc);

 

function onLoadInit(mc:MovieClip) {

trace("onLoadInit: " + mc);

}

 

 

}




 

I get NOTHING ! My external movieClips are not load or at least displayed.

 

But if If replace:

var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
getNextHighestDepth());

 

by

 

var NewMC_mc:MovieClip = createEmptyMovieClip("container"+i,
getNextHighestDepth());

 

it works.

 

But I want to load my external into the movie clip named
"ContentContainer_mc" present on the main scene on the root of my main
Movie.

 

What am I missing here ?

Must be stupid.

 

Any advice are welcome,

 

Thanks,

 

Hugues.

 

___
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



-
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.

-
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.

-
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ 
countries) for 2¢/min or less.
___
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] createEmptyMovieClip path

2006-04-07 Thread Boon Chew

At a glance, I caught at least one problem, not sure if they are others that 
could cause your problem.


var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
getNextHighestDepth());
You need to call getNextHighestDepth() on your ContentContainer_mc, like so:

var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
ContentContainer_mc.getNextHighestDepth()); 

- boon

 hbruyere <[EMAIL PROTECTED]> wrote: Hi,

 

I don't understand what I get when running this:

 




 

for (var i = 0; i < NumPages_v; i ++)

{

var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
getNextHighestDepth());

NewMC_mc._x = ScreenWidth_c * i;

NewMC_mc._y = 0;

var mcLoader:MovieClipLoader = new
MovieClipLoader();

mcLoader.addListener(this);

mcLoader.loadClip(WebsiteMap_a[i].File_tx,
NewMC_mc);

 

function onLoadInit(mc:MovieClip) {

trace("onLoadInit: " + mc);

}

 

 

}




 

I get NOTHING ! My external movieClips are not load or at least displayed.

 

But if If replace:

var NewMC_mc:MovieClip =
ContentContainer_mc.createEmptyMovieClip("container"+i,
getNextHighestDepth());

 

by

 

var NewMC_mc:MovieClip = createEmptyMovieClip("container"+i,
getNextHighestDepth());

 

it works.

 

But I want to load my external into the movie clip named
"ContentContainer_mc" present on the main scene on the root of my main
Movie.

 

What am I missing here ?

Must be stupid.

 

Any advice are welcome,

 

Thanks,

 

Hugues.

 

___
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



-
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.

-
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.
___
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] Find Nearest Color?

2006-04-06 Thread Boon Chew

^ is xor in C and Java as well.


elibol <[EMAIL PROTECTED]> wrote: This post is in spite of the discussion, I 
had adapted this function from
before, but originally I decided to not post it. I liked the problem so I
spent some time on it. I noticed Joshua that you used ^ in place of Math.pow,
while ^ maybe pow in C or maybe even Java, ^ is the xor operator in
Actionscript. So, the following code is a set of different methods to
getting the closest color with the non-pythagoras technique preceding the
pythagoras technique.

function getClosestHex(a:Number, b:Array){
var c=-1, d=b.length, e=768, f, a = [a>>>16, a>>>8&0x00FF, a&0xFF];
while(++c
Math.abs(a[0]-(b[c]>>>16))+Math.abs(a[1]-(b[c]>>>8&0x00FF))+Math.abs(a[2]-(b[c]&0xFF))
) )) f=c;
return b[f];
}

var a = 0x80807f;
var hexPalette:Array = [0x00, 0xFF, 0xFF, 0x00FF00, 0xFF,
0x00, 0xFF00FF, 0x00];
var getA = getClosestHex(a, hexPalette);
trace(getA.toString(16));

The former would be the method for hex numbers, however using RGB arrays is
quicker, I found converting the palette values to RGB arrays beforehand
would eliminate the redundancies of extracting color values, the following
code assumes the hexPalette array in the former code is defined.

function buildRGB(palette:Array){
var a=[], i=-1, l=palette.length;
while(++i>>16, palette[i]>>>8&0x00FF,
palette[i]&0xFF];
return a;
}

function getClosestColor(color:Array, palette:Array){
var c=-1, d=palette.length, e=768, f;
while(++c
Math.abs(color[0]-palette[c][0])+Math.abs(color[1]-palette[c][1])+Math.abs(color[2]-palette[c][2]
f=c;
return palette[f];
}

var b = [128, 128, 127];
var rgbPalette:Array = buildRGB(hexPalette);
var getB = getClosestColor(b, rgbPalette);
trace(getB);

This is what the code would look like using pythagoras:

function getClosestHex(a:Number, b:Array){
var c=-1, d=b.length, e=256, f, g, h, a = [a>>>16, a>>>8&0x00FF,
a&0xFF];
while(++c
g=0, h=-1;
while(++h<3) g+= Math.abs(Math.pow(a[h]-(b[c]<<8<<(h*8)>>>24), 2));
if(e!=(e=Math.min(e, Math.sqrt(g f=c;
}
return b[f];
}

var b = 0x80807f;
var hexPalette:Array = [0x00, 0xFF, 0xFF, 0x00FF00, 0xFF,
0x00, 0xFF00FF, 0x00];
var getB = getClosestHex(b, hexPalette);
trace(getB.toString(16));

function buildRGB(palette:Array){
var a=[], i=-1, l=palette.length;
while(++i>>16, palette[i]>>>8&0x00FF,
palette[i]&0xFF];
return a;
}

function getClosestColor(color:Array, palette:Array){
var c=-1, d=palette.length, e=256, f, w, z, x=color.length;
while(++c
w=0, z=-1;
while(++z
if(e!=(e=Math.min( e, Math.sqrt(w f=c;
}
return palette[f];
}

var a = [255, 128, 127];
var hexPalette:Array = [0x00, 0xFF, 0xFF, 0x00FF00, 0xFF,
0x00, 0xFF00FF, 0x00];
var rgbPalette:Array = buildRGB(hexPalette);
var getA = getClosestColor(a, rgbPalette);
trace(getA);

So, like Darren mentions, you could drop pythagoras and it would still be
accurate.

M.

On 4/4/06, Ron Wheeler  wrote:
>
> Another minor optimization
>
> Initialize tempDistance to a huge number (greater than the distance from
> ff000 toff) and then simplify the if
>
> Ron
>
> Darren Cook wrote:
> > Hi,
> > A minor optimization, but you can drop the Math.sqrt(). I.e.
> >x^2 > y^2  == x > y
> >
> > for all positive values of x and y.
> >
> > Darren
> >
> >
> >
> >> That's what I actually ended up doing, and it worked out pretty good:
> >>
> >> private function getClosest (red1:Number, green1:Number,
> >> blue1:Number):Number {
> >>
> >> var totalColors:Number = __palette.length;
> >> var tempDistance:Number;
> >> var closestColor:Number;
> >>
> >> for (var i:Number = 0; i < totalColors; i++) {
> >> // first, break up the color to check
> >> var red2:Number = (__palette[i] & 0xFF) >>> 16;
> >> var green2:Number = (__palette[i] & 0x00FF00) >>> 8;
> >> var blue2:Number = __palette[i] & 0xFF;
> >>
> >> // now, get the distance from the source
> >> var tempD:Number = Math.sqrt ((Math.abs(red1 - red2) ^ 2) +
> >> (Math.abs(green1 - green2) ^ 2) + (Math.abs(blue1 - blue2) ^ 2));
> >>
> >> if ((tempD <= tempDistance) || tempDistance == undefined) {
> >> tempDistance = tempD;
> >> closestColor = __palette[i];
> >> }
> >> }
> >>
> >> return closestColor;
> >> }
> >>
> >>
> >> - Josh
> >>
> >>
> >> On Mar 16, 2006, at 7:59 PM, Ron Wheeler wrote:
> >>
> >>
> >>> If a color can be treated as a point in a 3-d cube 256 units on  each
> >>> side, you can use the formula in this reference
> >>> http://www.uwm.edu/~ericskey/TANOTES/Ageometry/node10.html
> >>> to calculate the "distance" between 2 colors.
> >>>
> >>> I have not tried this but it would seem logical that this would work
> >>>
> >>> Ron
> >>>
>

[Flashcoders] Recommendation on good AS 2.0 framework code?

2006-03-29 Thread Boon Chew
Hi all, I am looking for some well-written framework code done in AS2.0 to read 
up on (Reading source is good for ya).  Does anyone have any recommendation on 
any well-written AS2.0 framework out there?

- boon


-
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ 
countries) for 2¢/min or less.
___
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] Instantiate AS2 classes from AS1...

2006-03-15 Thread Boon Chew

Hi,

I am posting this once more in case the post got buried.

I have a body of AS1.0 code that I inherited that is compiled under 
1.0.  I would like to keep it compiled with AS 1.0 but make it use any 
newly written AS2.0 classes.  Compiling the existing 1.0 code under AS2.0 
setting causes too many errors, don't have time for that now.

I am thinking that one option to do this would be to compile any newly 
created AS2.0 code into its own swf, and make the existing AS1.0 code 
load in the swf and instantiate the AS2 class that way, but I am having 
a little problem getting it to work.

Am I on the right path? Any ideas?

- boon


-
 Yahoo! Mail
 Use Photomail to share photos without annoying attachments.
___
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] Is it possible to make AS1.0 code instantiate AS2.0 objects without compiling it under AS2.0?

2006-03-14 Thread Boon Chew
Hi,

I have a body of AS1.0 code that I inherited that is compiled under 1.0.  I 
would like to keep it compiled with AS 1.0 but make it use any newly written 
AS2.0 classes.  Compiling the existing 1.0 code under AS2.0 setting causes too 
many errors, don't have time for that now.

I am thinking that one option to do this would be to compile any newly created 
AS2.0 code into its own swf, and make the existing AS1.0 code load in the swf 
and instantiate the AS2 class that way, but I am having a little problem 
getting it to work.

Am I on the right path? Any ideas?

- boon



-
Relax. Yahoo! Mail virus scanning helps detect nasty viruses!
___
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] AS2.0 mingles well AS1.0?

2006-03-14 Thread Boon Chew
Me and my coworkers are in the process of migrating a large body of old AS 1.0 
code to AS 2.0 (finally!).   Since it's impossible to rewrite everything in one 
fell swoop, we expect that for some time the system will be in a state in which 
it's mixed with AS 1.0 and AS 2.0.

Questions we have:

What sort of issues or potential problems should we be watching out for? 

What is your experience with AS1.0 code mingling with AS2.0 code? Positive, 
Negative?

Do you seen any problems with AS1.0 mixing with AS2.0 code, if we avoid using 
any Flash 7 specific API? (since theoretically AS2.0 compiles down to 1.0)

Initially the code will be compiled for Flash 6.0.  Do you see any problem with 
trying to compile the same code later for Flash 7?

- boon

-
Relax. Yahoo! Mail virus scanning helps detect nasty viruses!
___
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] Doh! Converting a floating point string to number loses precision

2006-03-07 Thread Boon Chew
It might not look like a big deal until you are using Flash to do some 
financial app, where you obtain a number from a string variable, convert it to 
a number, divide it with something and Math.floor it, all the while thinking 
it's the same as taking a number, divide it with something and Math.floor it.  
(The diff can be as big as 1 because of Math.floor).

- boon

Yotam Laufer <[EMAIL PROTECTED]> wrote: -1.13686837721616e-13 is as close to 
zero as you get matey 13 places
after the decimal...

On 07/03/06, Boon Chew  wrote:
>
>
> How do you usually deal with the loss in precision (a bit oxymoron since
> floating point can't be exactly represented) when converting a floating
> point string to a number?
>
> var s:String = "952.86";
> var i:Number = parseFloat(s);
> trace(i);
> trace(i - 952.86);   // Not zero!
>
>
> - boon
>
>
>
>
> -
> Yahoo! Mail
> Bring photos to life! New PhotoMail  makes sharing a breeze.
> ___
> 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
>



--
Yotam Laufer | Flash Developer | mobile +44 (0) 79 205 17 212 | skype:
ubermutt
___
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


-
 Yahoo! Mail
 Use Photomail to share photos without annoying attachments.
___
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] Doh! Converting a floating point string to number loses precision

2006-03-07 Thread Boon Chew

I am aware of this issue in precision loss in floating point computation.  But 
here we are talking about converting a number from string back to number.

Why is it so hard to implement this correctly in the VM to ensure that the 
string  when converted back to number is representated exactly the same as the 
number version?

Out of curiosity I implemented this piece of logic in C++ and the resulting 
floating point number represented in string is exactly the same after the 
conversion.

Looks like there is a bug in the string to number conversion.

- boon

Ron Wheeler <[EMAIL PROTECTED]> wrote: 
The way you deal with it will depend on what you want to do.

If you want to see is something is "close enough to zero" you subtract 
them and check the difference

if (Math.abs(i - 952.86)<=0.1){trace("close enough for me")}else 
{trace("Not the same")};

if (Math.abs(i - 952.86)<=0.01){trace("Really close ")}else 
{trace("Not yet the same")};

If you use enough leading zeros you will get code that never evaluates 
to true so do not get wild with leading zeros.

As long as you remember that numbers that are not explicitly cast as 
integers have to be treated with care, you will be alright.

This problem has been around the computer world for the last 50 years 
and will be around for some time to come, so we have to just deal with it.


Ron

Yotam Laufer wrote:
> -1.13686837721616e-13 is as close to zero as you get matey 13 places
> after the decimal...
>
> On 07/03/06, Boon Chew  wrote:
>   
>> How do you usually deal with the loss in precision (a bit oxymoron since
>> floating point can't be exactly represented) when converting a floating
>> point string to a number?
>>
>> var s:String = "952.86";
>> var i:Number = parseFloat(s);
>> trace(i);
>> trace(i - 952.86);   // Not zero!
>>
>>
>> - boon
>>
>>
>>
>>
>> -
>> Yahoo! Mail
>> Bring photos to life! New PhotoMail  makes sharing a breeze.
>> ___
>> 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
>>
>> 
>
>
>
> --
> Yotam Laufer | Flash Developer | mobile +44 (0) 79 205 17 212 | skype:
> ubermutt
>   
> 
>
> ___
> 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



-
Yahoo! Mail
Bring photos to life! New PhotoMail  makes sharing a breeze. 

-
Yahoo! Mail
Bring photos to life! New PhotoMail  makes sharing a breeze. 
___
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] Doh! Converting a floating point string to number loses precision

2006-03-07 Thread Boon Chew

How do you usually deal with the loss in precision (a bit oxymoron since 
floating point can't be exactly represented) when converting a floating point 
string to a number?

var s:String = "952.86";
var i:Number = parseFloat(s);
trace(i);
trace(i - 952.86);   // Not zero!


- boon




-
Yahoo! Mail
Bring photos to life! New PhotoMail  makes sharing a breeze. 
___
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] eval gone in AS3, how to get reference to mc via target name?

2006-03-04 Thread Boon Chew

The problem is when you get an entire string (the
target name), you just want to get to the reference in
one shot (e.g. "mc1.mc2.mc3").  The collection method
requires parsing before you can get to the reference. 
I was hoping Macromedia would provide at least a
similar way to get to it when they retire eval in AS3.

- boon

--- ryanm <[EMAIL PROTECTED]> wrote:

> > With the eval being gone in AS3, does anyone know
> how to get to the
> > reference of a movieclip (via the target name
> string) without using eval?
> > I know we can instantiate the class via the
> _global namespace but not
> > positive about mc's.
> >
> 
> Using the object collection, like you should've
> been doing since eval 
> was depreciated.
> 
> parentclip["clipname"]
> 
> Works for nested targets too:
> 
> parentclip.subclip["clipname"]
> or
> parentclip["subclip"]["clipname"]
> 
> Like this:
> 
> trace(parentclip["subclip"]["clipname"]._x);
> or
> trace(_root["clip1"]["clip2"]["clip3"]["clip4"]._x)
> 
> ryanm 
> 
> ___
> 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
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam
protection around 
http://mail.yahoo.com 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.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] eval gone in AS3, how to get reference to mc via target name?

2006-03-03 Thread Boon Chew

Will getChildByName work with a nested target name (e.g. "_level0.mc1.mc2.mc3")?

- boon

"Darron J. Schall" <[EMAIL PROTECTED]> wrote: Boon Chew wrote:
> With the eval being gone in AS3, does anyone know how to get to the reference 
> of a movieclip (via the target name string) without using eval?  I know we 
> can instantiate the class via the _global namespace but not positive about 
> mc's.

Use getChildByName( name):
http://livedocs.macromedia.com/labs/1/flex/langref/flash/display/DisplayObjectContainer.html#getChildByName()

Also, you should be using getClassByName( name ) to create a class based 
on it's name:
http://livedocs.macromedia.com/labs/1/flex/langref/flash/util/package.html#getClassByName()


-d
___
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



-
Yahoo! Mail
Bring photos to life! New PhotoMail  makes sharing a breeze. 

-
Yahoo! Mail
Bring photos to life! New PhotoMail  makes sharing a breeze. 
___
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] eval gone in AS3, how to get reference to mc via target name?

2006-03-03 Thread Boon Chew
Hi all,

With the eval being gone in AS3, does anyone know how to get to the reference 
of a movieclip (via the target name string) without using eval?  I know we can 
instantiate the class via the _global namespace but not positive about mc's.


- boon


-
 Yahoo! Mail
 Use Photomail to share photos without annoying attachments.
___
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] Help: Is it possible to have event handlers for parent and child clips?

2005-12-19 Thread Boon Chew
I am creating a UI today that has a fairly complex interaction.
  And I need to do roughly the following:
  
  Assign onRollOver/onRollOut event handlers to mcParent
  AssignonPress handle to mcChild (contained inside mcParent)
  
  I find that once mcParent is given an event, the child event handler can no 
longer work, even though the event is different.
  
  Am I missing something here, or is this just plain not possible?
  
  - boon
  

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] custom trace

2005-12-13 Thread Boon Chew

  Pardon me if this has been asked before, is there a way to override the  
trace( ) function?  I have inherited a body of code, short of  doing global and 
replace to make it call my custom trace, I would like  to "reroute" the trace( 
) call to my own implementation.  But I am  not sure if trace is a function 
intrinsic to the AVM?  Is that  possible?
  
  - boon
  


-
Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping 
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Even odds

2005-12-08 Thread Boon Chew
Yet another way (and probably the fastest):
  
var isOdd:Boolean = Boolean(num & 1);
  
  - boon

Mike Boutin <[EMAIL PROTECTED]> wrote:  Is it possible to check a number to see 
if its even / odd?


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




-
Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping 
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Need advice on how to play a series of mc back to back elegantly

2005-12-08 Thread Boon Chew
Hi all, I ran into this situation of tangling code and I don't like it and I 
need input on how to improve it. :)
  
  I wrote a class called PlayHeadNotifier that basically observes the  playhead 
location of a movieclip, and notifies me when it hits a stop  frame (or end of 
frame, or every frame, depends on what I tell it to).
  
  Here is s a sample usage:
  mc.gotoAndPlay("start");
  var notifier = new PlayHeadNotifier(
{ 
   target:  mc,  // the movie being observed
notifyType: PlayHeadNotifier.STOP,  // 
notified  when hit stop
   callback:  Delegate(this, startDone) // 
function to call back to
});
  
 The problem I have is sometimes in a  fancy UI transition effects, I need to 
play a series of MC back to  back, so I end up having a series of callback 
functions, one being  called after another...it seems rather ugly.
  
 Any advice on  how to perform a sequence of mc animations back to back 
achieved  cleanly? (without adding any code to the timeline)
  
  - boon
  
  
  


-
Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping 
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] floating point

2005-12-07 Thread Boon Chew
  
This has to do with the fact
that not every decimal value can be exactly
represented by a binary floating point.  So the results
of adding a bunch of binary numbers that is not exact 
to begin with will come out to be
different than the actual binary floating point for 0.8.

You can either turn the comparison into an integral
one as some has proposed or introduce 
an absolute error (epsilon) into the comparison:

if (Math.abs(i - 0.8) < 0.1) trace("here");


- boon
  

Hans Wichman <[EMAIL PROTECTED]> wrote:  Hi peeps,
related discussions have been on here before, but i didn't find a real answer.
Imagine this piece of code:
var i = 0;

onEnterFrame = function () {
 i = i + 0.1;
 trace (i);
 if (i == 0.7) trace("here");
}

as you might expect, after running for 7 frames, it traces "here".
However if you change 0.7 to 0.8, it stops working.

I assume this is to floating point math and rounding errors and stuff?
In what way can i check for equality to 0.7 then? With a bigger than, 
smaller than construction?

This seems so weird to me...

greetz
Hans

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




-
 Yahoo! Personals
 Let fate take it's course directly to your email.
 See who's waiting for you Yahoo! Personals
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How to update components on stage?

2005-12-04 Thread Boon Chew

Michael totally spelled out the problem.  I have about
10 instances of the component on stage, every time I 
add a new inspectable attribute to the class, I have
to replace them all, and swapping symbols won't work
either.  What a pain!

- boon

--- Michael Stuhr <[EMAIL PROTECTED]> wrote:

> Eric E. Dolecki schrieb:
> 
> >Just replace the component on the Stage with the
> component with the  
> >changed inspectable params.
> >
> >edolecki
> >
> >  
> >
> but then you'd have to reposition - resize and what
> not ... wasn't there 
> an extension ... no i believe not. See the 'problem'
> is, that if you've 
> got a normal clip on stage, you'd select it's
> library item through 
> property panel. but with components i believe you
> can't right ?
> 
> It#s not THAT big deal, but it would be nice if we
> could.
> 
> micha
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
>
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 




__ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 

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


RE: [Flashcoders] where and how can I learn actionscript bytecode

2005-12-04 Thread Boon Chew

  Thanks for the tip Ted.
  
  Curious, how are you using python with flasm? (that is, what sorts of stuff 
are you doing with the combo)
  
  - boon

Theodore E Patrick <[EMAIL PROTECTED]> wrote:  Boon,

Use FLASM. It provides text output representing AS Bytecode.

http://flasm.sourceforge.net/

Simply do this:

// decompress the AS block using zlib
>> flasm -x myfile.swf

// read the bytecode into a text file
>> flasm -d myfile.swf > myfile.flm

Open myfile.flm to see all the bytecode instructions.

Flasm is still my favorite Flash tool and scripting Flasm with Python is a
hell of allot of fun.

Cheers,

Ted ;)



> -Original Message-
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Boon Chew
> Sent: Saturday, December 03, 2005 10:41 PM
> To: flashcoders@chattyfig.figleaf.com
> Subject: [Flashcoders] where and how can I learn actionscript bytecode
> 
> 
> Is there any tools or documentation out there that
> will aid in learning actionscript bytecode?
> 
> I ran into this the other day, and it seems like only
> reading the bytecode can help me understand why it
> doesn't work?
> 
> class A
> {
>function destroy()
>{
>   delete this;  // doesn't delete itself
>}
> }
> 
> var a = new A();
> delete a;  // delete works here
> 
> - boon
> 
> 
> 
> __
> Start your day with Yahoo! - Make it your home page!
> http://www.yahoo.com/r/hs
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.362 / Virus Database: 267.13.11/191 - Release Date: 12/2/2005
> 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.11/191 - Release Date: 12/2/2005
 

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




-
 Yahoo! DSL Something to write home about. Just $16.99/mo. or less
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Flash is a single-threaded app? Maybe it's just the AVM? or...

2005-12-03 Thread Boon Chew

  I have read in this  forum that someone loosely coined the phrase "Flash is a 
single thread  app", it's hard to imagine something as high performance and 
intricate  as Flash to be a single-threaded app.
  
  So I started to take the above statement to mean that the Actionscript  VM 
executes all the code in a sequential fashion but that Flash player  itself is 
multithreaded, is that a right assumption?
  
  And what about code that are asynchronous in nature, such as sound playing ( 
new Sound(), onSoundComplete), server-side call  return (such as LoadVars, 
XML.onLoad)?  Are these all happening in the single thread of code execution?
  
  Looks like a book on Flash and AVM Internal would be nice. :)
  
  - boon
  
  

-
 Yahoo! Personals
 Single? There's someone we'd like you to meet.
 Lots of someones, actually. Try Yahoo! Personals
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] How to make a class instance self-destructible?

2005-12-03 Thread Boon Chew
Good stuff Steven, I am glad I asked this question (and David's reply is great).
  
  Is there a way to verify that the onLoad is indeed orphaned in the VM memory 
pool?
  
  
  - boon
  

Steven Sacks <[EMAIL PROTECTED]> wrote:  Here is something more for you to chew 
on:

If you assign say an onLoad method to an object, and don't delete the onLoad
before you delete the object, the onLoad method is orphaned and since the
reference to the object is gone, it does not get cleaned up by the garbage
collector, and remains in memory with no way to get to it.

For example (AS1 code used here):

foo = new XML();
foo.onLoad = function(valid) {
 if (valid) {
  // xml loaded successfully
 } else {
  // xml load error
 }
}

If you:

delete foo;

the foo.onLoad method stays in memory.

You have to

delete foo.onLoad;
delete foo;

to really get rid of foo.

Objects cannot delete themselves, nor can they call another object to delete
them because technically you're still in the same operation thread.  It has
to be done independantly outside the object you're trying to delete.

The way I get around this is:

xmlHolder = {};
var id = new Date.getTime();
xmlHolder[id] = new XML();
xmlHoLDer[id].onLoad = function(valid) {
 if (valid) {
  // xml loaded successfully
 } else {
  // xml load error
 }
 this.complete = true;
}

I assign a complete = true property.  Then, I have my own little clean up
tool running, checking for complete xml loads:

for (var o in xmlHolder) {
 if(this.xmlHolder[o].complete) {
  delete this.xmlHolder[o].onLoad;
  delete this.xmlHolder[o];
 }
}

The clean up tool is running in a separate thread therefore it can delete
other xmlHolder without issue.

HTH,
Steven

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




-
 Yahoo! Personals
 Skip the bars and set-ups and start using Yahoo! Personals for free
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] How to update components on stage?

2005-12-03 Thread Boon Chew
Hi, I created a component today, subclassing it from MovieClip (it's my first 
component, so excuse me for my newbie question).
  
  I realize that everytime I update the Inspectable( ) in the AS file, I  have 
to reopen the movieclip component, click OK to have it updated  with the new 
change.
  
  But the components already on stage don't pick up the update.  And  I can't 
find a way for them to pick up the update, short of putting the  component on 
stage again.  Could someone help?
  
  - boon
  


-
 Yahoo! Personals
 Let fate take it's course directly to your email.
 See who's waiting for you Yahoo! Personals
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] How to make a class instance self-destructible?

2005-12-03 Thread Boon Chew
I am trying to get a class to destroy itself, calling delete obj looks too 
unnatural, amidst all OO code.
  
  Could someone explain why the following doesn't work?
  The following code doesn't work, is there another way to achieve this?  Also, 
  
class A
{
   function destroy()
   {
  delete this;  // doesn't delete itself
   }
}

var a = new A();
delete a;  // delete works here
  


-
 Yahoo! DSL Something to write home about. Just $16.99/mo. or less
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] where and how can I learn actionscript bytecode

2005-12-03 Thread Boon Chew

Is there any tools or documentation out there that
will aid in learning actionscript bytecode?

I ran into this the other day, and it seems like only
reading the bytecode can help me understand why it
doesn't work?

class A
{
   function destroy()
   {
  delete this;  // doesn't delete itself
   }
}

var a = new A();
delete a;  // delete works here

- boon



__ 
Start your day with Yahoo! - Make it your home page! 
http://www.yahoo.com/r/hs
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Loading Different Size MovieClips depending on the Resolution.

2005-12-01 Thread Boon Chew
You can use the System.capabilities object to determine the client display 
resolution and load your movieclip accordingly.
  
  
http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary705.html
  
  - boon

Nicholas Chhabra <[EMAIL PROTECTED]> wrote:  Hey Guys,

I was just wondering what the ActionScript was for loading a different 
movie clip depending on the resolution fo the client. Is there a way tod 
o this (I'm sure there is!).

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




-
 Yahoo! Personals
 Skip the bars and set-ups and start using Yahoo! Personals for free
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Creating a button class entirely in 2.0 with no symbol association, possible?

2005-11-24 Thread Boon Chew
Ian, thanks for the solution you posted.  It should work perfectly for me.

Ian Thomas <[EMAIL PROTECTED]> wrote:  On 11/24/05, Boon Chew  wrote:
>
> Thanks Janis.  The problem with doing it  below is that you cannot change
> _x, _y directly on the mc like you can  with a regular movieclip.
>
>   var b = new myButton();
>   b._x = 200; <-- won't work


Boon,
   You're quite correct - however the solution I posted will work. It lets
you use the class in all cases like a normal MovieClip object.

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




-
 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Creating a button class entirely in 2.0 with no symbol association, possible?

2005-11-23 Thread Boon Chew
Thanks Janis.  The problem with doing it  below is that you cannot change _x, 
_y directly on the mc like you can  with a regular movieclip.
  
  var b = new myButton();
  b._x = 200; <-- won't work
  

Janis Radins <[EMAIL PROTECTED]> wrote:  I'm doing this all the time I've made 
tonns of different inputs fro
diferent projects and finally I am planing to code some fullscale AS2
only UI collection.

Thats done like this:
class myButton {
private var mc:MovieClip;
function myButton(host:MovieClip, level:Number){
mc= host.createEmptyMovieClip("myButton"+level, level);
}
}
In this case all drawing is done by variable mc.

2005/11/23, Ian Thomas :
> Oops, last line should be:
>
> var button:MyButton=MyButton(myTimeline.attachMovie(MyButton.symbolName,
> "somRandomButton",
> myTimeline.getNextHighestDepth()));
>
> Assuming myTimeline is whatever you're trying to attach the button to...
>
> Ian
>
> On 11/23/05, Ian Thomas  wrote:
> >
> > Hi Boon,
> >   Can't remember where I got this solution - definitely not mine - but
> > here's how to create a MovieClip-derived class that doesn't need an
> > associated library symbol:
> > --
> > class net.something.MyButton extends MovieClip
> > {
> > static var symbolName:String = "__Packages.net.something.MyButton ";
> > static var symbolOwner:Function = MyButton;
> >
> > public function MyButton()
> > {
> > }
> >
> > static var symbolLinked=Object.registerClass(symbolName, symbolOwner);
> >
> > }
> > --
> > To create it, use attachMovie:
> >
> > import net.something.MyButton;
> >
> > var button:MyButton=MyButton(myTimeline.attachMovie(MyButton.symbolName,
> >
> > "somRandomButton",getNextHighestDepth()));
> >
> > HTH,
> >   Ian
> ___
> 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




-
 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Creating a button class entirely in 2.0 with no symbol association, possible?

2005-11-23 Thread Boon Chew

Hi all, is there a way to create a Button class that
is entirely done in an AS2.0 class, with no
association to any symbol in the library.

For example, I have a class (shown below) but right
now it's associated with an empty movieclip in the
library -- this is the only I can get this to work.  I
am trying to find a way to remove the need for that
association, and have everything in the code instead
(including the createEmptyMovieClip).  Is that
possible? I tried it but couldn't find a way that
works.

class NavButton extends MovieClip
{
private function NavButton()
{
init();
}

private function init()
{
this.lineStyle(1, 0x00, 100);
this.beginFill(0x00, 100);
this.moveTo(0, 0);
this.lineTo(100, 0);
this.lineTo(100, 100);
this.lineTo(0, 100);
this.lineTo(0, 0);
this.endFill();
}

static function create(timeline:MovieClip,
initParams:Object):NavButton
{
var depth =
timeline.getNextHighestDepth();
return NavButton(timeline.attachMovie("button",
"button" + depth, depth, initParams));
}
}




__ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How to pass init param from movieclip to its associated AS2 class

2005-11-17 Thread Boon Chew
Thank you Muzak.  I remember reading it, I  will read the whole thing again so 
it sticks.  Is there any reason  why we shouldn't do this to every class that 
we associate an AS2.0  class with?  That is, is there any downside if I just 
associate  all my mc with the AS2.0 class in the Component Definition instead 
of  the Linkage property?  It seems like Component definition has the  added 
niceties that allows you to set the parameters in the IDE.
  
  - boon

Muzak <[EMAIL PROTECTED]> wrote:When  setting the AS2.0 class in the Component 
Definition window, you'll be  able to add [Inspectable] MetaData to the class, 
which 
will then show up in the Properties Panel (parameters).
Parameters defined in the properties panel will be set *before* the constructor 
of the class is exectuted, avoiding the 1 frame 
delay that otherwise occurs.

Check out the docs for more info on Metadata:
Using Components > Creating Components > Creating the AS class file > Adding 
component metadata

regards,
Muzak


- Original Message - 
From: "Boon Chew" 
To: "Flashcoders mailing list" 
Sent: Friday, November 18, 2005 12:41 AM
Subject: Re: [Flashcoders] How to pass init param from movieclip to 
itsassociating AS2 class


> Thanks David for the tip.
>
>  I would like the artist to set certain values, so ideally, a method  that 
> doesn't require them to mess with the script window is 
> the best.
>
>  Would it be ok if I add parameters to the Component Definition? Behind  the 
> scene what is the difference between a movieclip vs 
> a  movieclip with component definition set? It seems like both behave like  a 
> regular mc anyways...except that one you can 
> compile into  SWC.
>
>  Another question I have is that component can also be associated with  AS 2 
> as well, what's the effects of setting AS2 there 
> alongside with  AS2 in linkage property?
>
> David Rorex  wrote:  In your class, define the variable you want to pass in, 
> like:
>
> class Test extends MovieClip
> {
>  var passedIn;
>
>  //...
> }
>
> Then, on the stage, select your movieclip instance, and bring up the
> actionscript window (press F9), and enter the code:
>
> onClipEvent(load)
> {
> passedIn = 123;
> }
>
> NOTE: Passed in variables will not be availabe until 1 frame after the
> component loads (I think), so either don't use them in the
> constructor, or put a 1 frame delay.
>
> -David R
>
> On 11/17/05, Boon Chew  wrote:
>> Hi all,
>>
>>  I have created a movieclip and associated it to an AS2 class in the  
>> linkage property. I have different instances of this 
>>  movieclip on stage and I would like to pass different init params to  the 
>> AS2 class. Is there a way to do it in the IDE? Must I 
>> turn the movieclip to a  component in order to pass init params?
>>
>>   Thanks!


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




-
 Yahoo! FareChase - Search multiple travel sites in one click.  
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How to pass init param from movieclip to its associating AS2 class

2005-11-17 Thread Boon Chew
Thanks David for the tip.
  
  I would like the artist to set certain values, so ideally, a method  that 
doesn't require them to mess with the script window is the best.
  
  Would it be ok if I add parameters to the Component Definition?   Behind the 
scene what is the difference between a movieclip vs a  movieclip with component 
definition set?  It seems like both  behave like a regular mc anyways...except 
that one you can compile into  SWC.
  
  Another question I have is that component can also be associated with  AS 2 
as well, what's the effects of setting AS2 there alongside with  AS2 in linkage 
property?

David Rorex <[EMAIL PROTECTED]> wrote:  In your class, define the variable you 
want to pass in, like:

class Test extends MovieClip
{
  var passedIn;

  //...
}

Then, on the stage, select your movieclip instance, and bring up the
actionscript window (press F9), and enter the code:

onClipEvent(load)
{
 passedIn = 123;
}

NOTE: Passed in variables will not be availabe until 1 frame after the
component loads (I think), so either don't use them in the
constructor, or put a 1 frame delay.

-David R

On 11/17/05, Boon Chew  wrote:
> Hi all,
>
>  I have created a movieclip and associated it to an AS2 class in the  linkage 
> property. I have different instances of this movieclip on stage  and I would 
> like to pass different init params to the AS2 class. Is  there a way to do it 
> in the IDE? Must I turn the movieclip to a  component in order to pass init 
> params?
>
>   Thanks!
>
>
> -
>  Yahoo! FareChase - Search multiple travel sites in one click.
> ___
> 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




-
 Yahoo! FareChase - Search multiple travel sites in one click.  
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] How to pass init param from movieclip to its associating AS2 class

2005-11-17 Thread Boon Chew
Hi all,
  
  I have created a movieclip and associated it to an AS2 class in the  linkage 
property.  I have different instances of this movieclip on  stage and I would 
like to pass different init params to the AS2  class.  Is there a way to do it 
in the IDE?  Must I turn the  movieclip to a component in order to pass init 
params?
  
  Thanks!
  

-
 Yahoo! FareChase - Search multiple travel sites in one click.  
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Weird, child control's method can't be called in container's init()?

2005-10-26 Thread Boon Chew
Hi, have a question here that I don't quite understand
why it happens and how to get around it...

I have a movieclip called mcScrollBar, and it's
associated with an AS2 class (via the linkage
property) called UI.ScrollBar.

The scroll bar contains another movieclip, called
mcScrollButton, and this is associated with the class
UI.ScrollButton.

Iif I try to call a method in ScrollButton from
ScrollBar's init(), the method
doesn't exist!  Am I missing something here?  The
behavior doesn't seem to make sense, you would think
that all the containing child objects are initialized
and fully constructed before you reach init() in the
container class.

The class looks roughly like this:

class UI.ScrollBar extends UI.Control
{
  private var mcScrollButton: ScrollButton;

  function ScrollBar()
  {
  }

  function init()
  {
super.init();
   
mcScrollButton.setDragRange(0, 100); <- doesn't
work, but calling it later in time in another function
will work.
  }
}

class UI.ScrollButton
{
   ...
   function setDragRange() { }
}



__ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders