Re: [Flashcoders] Realaxy ActionScript Editor public beta

2010-06-10 Thread Mark Winterhalder
2010/6/10 Cor :
> This is free and works perfectly:

If you happen to be on Windows, yes.

Are there any plans for haXe support in the future?
Also, I couldn't find any screenshots on the site. I'd like to get an
impression before I download, and don't want to start the trial period
until I have some time for a small personal project.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] @#$% New iPhone Developer Agreemen t Bans the Use of Adobe¹s Flash-to-iPhone Compiler

2010-04-16 Thread Mark Winterhalder
On Fri, Apr 16, 2010 at 2:22 PM, Andrew Murphy  wrote:
> By requiring developers to jump through hoops to create content for their
> devices, Apple makes it more likely that that content will only be available
> on their devices, making it exclusive.

Yes, cross-platform development commoditizes hardware.

Apple doesn't give you many options. For example, with the new MBP's,
the 13" model is Core2Duo only and doesn't have the matte screen
option. If you want an i5, you must buy the 15" version. They all come
with a fancy GPU that I don't need and don't want to pay for. This is
even more extreme for mobile devices, which through size and battery
power have an inherent need to compromise at one end or the other.

So, if you can get the same apps on other devices, nothings stopping
you from getting the device that best fits your need -- screen size,
performance vs. battery life, LED flash or not, changeable
batteries... But iP*-only apps are a way to offer exclusive content
that requires special hardware to access.

Apple is a hardware manufacturer. They always were. All non-hardware
activity serves the sole purpose of selling their hardware.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] @#$% New iPhone Developer Agreemen t Bans the Use of Adobe’s Flash-to-iPhone Compiler

2010-04-12 Thread Mark Winterhalder
On Mon, Apr 12, 2010 at 5:24 PM, Jon Bradley  wrote:
> Although all of us would love to develop iPhone and iPad applications using
> the Flash platform, frankly that is not a proper methodology for developing
> for these systems, in my opinion.

That depends on what it is that you want to develop. 3D racing game?
By all means, use your C variant of choice and OpenGL ES. Interactive
magazine or simple puzzle? You could do it in Flash in a fraction of
the time. That's "proper methodology." As it is, there's a huge gap
between stuff you can do cross-platform in the browser and what
actually needs the performance you get out of a native app.

I absolutely agree that if you want to write something non-trivial,
which requires a lot of processing power, for the iP* family, you
should learn Obj-C. It's really not that hard, and hopefully the
investment will pay off eventually. But there are many scenarios where
you just want to target "mobile devices," and possibly also want a Web
version.
The way things appear to be turning out, supporting both the iPhone
and "Flash enabled devices" will significantly add to the cost in such
a scenario, not unlike the Browser Wars in the not-so-good ol' days.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] @#$% New iPhone Developer Agreemen t Bans the Use of Adobe’s Flash-to-iPhone Co mpiler

2010-04-12 Thread Mark Winterhalder
On Mon, Apr 12, 2010 at 2:11 PM, p...@ipauland.com  wrote:
> It's difficult ground. If I buy CS5 with iPhone export, I expect to be able to
> legitimately use it. Where does that leave Adobe if they sell me something I
> can't legitimately use? Are they misleading me?

There's a new enterprise internal distribution thingie coming, AFAIK,
so there still would be legitimate use. "Just" no App Store.

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


Re: [Flashcoders] @#$% New iPhone Developer Agreement Bans the Use ofAdobe's Flash-to-iPhone Compiler

2010-04-09 Thread Mark Winterhalder
On Fri, Apr 9, 2010 at 5:12 PM, Merrill, Jason
 wrote:
> What you may see happen is consumers getting tired of not
> having Flash on their iPhone and switching to an Android phone.

Which is why I can't wait to see FP 10.1 and AIR on Android. If it's
done well, it will tear the technical-reasons veil right from Job's
face and consumers will begin asking questions.

Instead of pulling CS for OSX, Adobe should try to port it to Linux
instead. I know that's easier said than done, but it would send a
strong signal, also to other companies, that Linux has become a viable
alternative.

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


Re: [Flashcoders] @#$% New iPhone Developer Agreemen t Bans the Use of Adobe’s Flash-to-iPhone Compiler

2010-04-08 Thread Mark Winterhalder
On Fri, Apr 9, 2010 at 3:00 AM, Carl Welch  wrote:
> http://daringfireball.net/2010/04/iphone_agreement_bans_flash_compiler
>
> I can't even explain how frustrated I am about apple. I just feel that Mr
> Job's is just giving the finger to so many people that have supported and
> promoted his company since day one. ugh.

Frustrated doesn't even begin to describe it.

My theory is that it's about vendor lock-in. Cross platform
development offers a way around it -- if the exact same apps you payed
for and, maybe more importantly, got used to, are available for
Android, then you can switch away from iPhone OS.

Mobile devices always are a compromise. You weight CPU performance
against battery life, make a decision about screen size, and so on.
Apple has a two-sizes-fit-all product line, while a number of
manufacturers produce a growing variety of Android devices.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Events can be tedious, general thoughts on best practice?

2010-03-24 Thread Mark Winterhalder
On Wed, Mar 24, 2010 at 7:03 PM, Taka Kojima  wrote:
> I'm curious as to other people's thoughts on
> this in terms of good/bad practice and what the pros/cons to this approach
> might be.

My thoughts are that it's OK for the very common cases which don't
need the flexibility of events.

Advantages of events:

 * multiple listeners
 * one listener for multiple targets/types
 * progress events etc.
 * you'll have events all over your project anyway, period.
 * it's what other coders are familiar with

The last one's important if other devs /might/ have to work with your
code. For this it will only take me a minute to look up "that strange
loader class I don't know", but if you use too many of those it adds
up, and at some point I won't want to play with you no more.

Personally, I'll stick with events, and I don't mind them at all.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] ASDoc question re: documenting events

2010-03-23 Thread Mark Winterhalder
On Tue, Mar 23, 2010 at 8:36 PM, Merrill, Jason
 wrote:
>  You use @see
> instead of @eventType when documenting an event?

Not anymore, now that I've learned about @eventType. :)

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


Re: [Flashcoders] ASDoc question re: documenting events

2010-03-23 Thread Mark Winterhalder
On Tue, Mar 23, 2010 at 5:18 PM, Merrill, Jason
 wrote:
> like you see in the help docs.

Are you looking at the same docs I'm looking at?
Because mine only have the String, not the constant name listed under Events.

Here's what I use:

/**
 * Description
 *
 * @see com.foo.CustomEventClass
 */ 
[Event( name="eventName", type="com.foo.CustomEventClass" )]
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Anyone know of a flasm-equivalent for AS3 swf command-line disassembly/assembly?

2010-03-19 Thread Mark Winterhalder
Well, there's abcdump, but you can't use that for a round-trip.

It's not a ready-to-use product, but hxformat is a haXe library that
supports SWF and ABC (the AS opcodes) read/write:



It's haXe, so you can compile it as SWF/SWC or as a Neko-VM based
standalone app, and it's very similar to AS3, but there's still some
work left to do to get a proper (dis-)assembler out of that library.
Maybe somebody has done it already, but I don't know.



On Fri, Mar 19, 2010 at 11:52 PM, Ricky Blaha  wrote:
> I am aware that sothink, hp swfscan, and burak's asv support AS3
> decompiling, but to my knowledge none of those support command-line
> disassembly/assembly like flasm does for AS1/2.
>
> ~R
> ___
> 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] proper way for Flash to store user passwords

2010-03-19 Thread Mark Winterhalder
On Fri, Mar 19, 2010 at 10:05 PM, Andrew Sinning
 wrote:
> Since putting the login screen in html isn't an option, then should I just
> make the user re-enter their password everytime, or would it be appropriate
> to include a "Remember my password on this computer" check box and then use
> a local SharedObject if they allow it?

The problem is that many users use the same login/password combination
across sites, even for Important Stuff. You would store those
credentials in the clear, which generally isn't a good idea.

How about a "remember me on this computer" option instead? You'd only
have to store a sessionID, which is less bad.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] proper way for Flash to store user passwords

2010-03-19 Thread Mark Winterhalder
On Fri, Mar 19, 2010 at 8:43 PM, Eric E. Dolecki  wrote:
> Try this:
>
> http://www.marksanborn.net/php/creating-a-secure-md5-hash-for-storing-passwords-in-a-database/

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


Re: [Flashcoders] proper way for Flash to store user passwords

2010-03-19 Thread Mark Winterhalder
> When I log in to gmail, ebay, etc., my passwords are pulled from a "vault",
> which I have access to by virtue of being logged in to my computer.  I can
> look these up in my browser.

...and that's why you should leave it as part of the HTML. Some users
use password managers for their browsers that are quite secure. Your
password would not be included, and that would make some people very
angry (and rightfully so.)



On Fri, Mar 19, 2010 at 8:36 PM, Andrew Sinning  wrote:
> I use SharedObject.getLocal() to store preferences from Flash, but what
> about passwords?
>
> When I log in to gmail, ebay, etc., my passwords are pulled from a "vault",
> which I have access to by virtue of being logged in to my computer.  I can
> look these up in my browser.
>
> What's an acceptable way to store passwords?  Is it okay to just use
> SharedObject.getLocal()?
> ___
> 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] AS3 -> Objective-C

2010-03-16 Thread Mark Winterhalder
For those interested, iTunes-U has a Standford course for iPhone development.




On Tue, Mar 16, 2010 at 4:57 PM, Steven Loe  wrote:
>
>
> I've dabbled with iPhone development, and in a month or so, you can get 
> familiar with the development process and the language. But to be really 
> good, you'll probably need something like this:
>
> http://stevenloe.com/iphone/learn_iphone_development_in_5_easy_steps.jpg
>
> -Steven Loe
>
>
>> Right, but I thought the question was, "how challenging was it to switch
>> to Objective-C from Actionscript 3"? - not "can I program for other
>> languages like c++ and PHP using a language similar to Actionscript"?
>> Seems like a completely different question to me.
>>
>>
>> Jason Merrill
>>
> ___
> 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] Bezier curve arrows

2010-03-16 Thread Mark Winterhalder
"Actionscript generated curves" are quadratic beziers. The angle is
easy to get at the end points -- the (quadratic) bezier is defined by
three points, one where you start and two that you pass to the curveTo
method. By definition, the line defined by those two points is the
tangent at the end point.
Use Math.atan2 to get the angle, then rotate your clip accordingly.

HTH,
Mark


On Tue, Mar 16, 2010 at 5:02 PM, p...@ipauland.com  wrote:
> I was recently asked if I could add some arrowheads to some actionscript
> generated curves. I initially thought "Triangle pointing to end point", and 
> that
> would be a great solution. I can place a MC at the end of the curve, but how 
> can
> I get the right angle to point it to?
>
> Paul
> ___
> 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] OOP Tutorial

2010-03-06 Thread Mark Winterhalder
On Fri, Mar 5, 2010 at 4:47 PM, Susan Day  wrote:
> I've been googling as3 oop but the
> tutorials don't seem to address my needs. Can you help me understand what it
> is I'm looking to do so I can google up the appropriate tutorials?

Wikipedia is your friend for looking things up, and getting an
overview of what is out there:


Apart from books and websites, there's also another option: Google
'Open Course Ware' and have a look at iTunes U for video lectures or
podcasts. You probably won't find much that is AS3 specific, but e.g.
Java is very similar. For learning OOP concepts, the differences don't
matter.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Mark Winterhalder
On Tue, Feb 23, 2010 at 6:43 PM, Glen Pike  wrote:
> why would you want to use more memory by storing the sprite instances in an
> array or a vector when you already have a storage medium for them - the
> parent container?

We're talking about only nine instances here. It would be a different
matter if it were tens or hundreds of thousands, but even then the
additional memory required to store another reference to them would be
insignificant compared to the memory the Sprites themselves would use,
and performance would be the far bigger issue.

So, a descriptively named collection has a higher benefit, for
readability alone. Preferably a Vector, so casting isn't necessary
even when the Sprites for the bars become a proper Bar class, as they
probably should.

I'd still put them in their own container, though. Then the container
goes on top of another with the lines.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Class Property vs. Static Property?

2010-02-23 Thread Mark Winterhalder
I'm just guessing here, but maybe he's referring to properties of the
prototype Object? Because, I don't see it on the list.
Then again, I would expect access to instance properties to be faster,
based on the assumption that they take precedence.

I guess somebody will have to recreate the test and find out. :)


On Tue, Feb 23, 2010 at 5:14 PM, Jer Brand  wrote:
> This feels like a really stupid question, but it's stuck in my head:
>
> http://gskinner.com/talks/quickNL/#44
>
> On that slide (slide 44) he references access speed for "Literal", "Local",
> "Instance", "Static" and "Class" properties. Apparently my OOP terminology
> is bleeding together here, but what's the difference between a Static and
> Class property -- I thought they were the same thing? Does the graph refer
> to using dynamic class properties such as with object?
>
> Anyone got a clue they want to loan me for a bit?
>
> Jer
> ___
> 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] Back On Course, Still Problems

2009-12-08 Thread Mark Winterhalder
On Tue, Dec 8, 2009 at 10:52 AM, beno -  wrote:
> I promised I would buy the books around the end of the year.

In case you're interested, Safari Books has a free 10 day trial. I
haven't tried it myself, but I hear it's good.


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


Re: [Flashcoders] Operator Help!!

2009-05-21 Thread Mark Winterhalder
On Fri, May 22, 2009 at 12:28 AM, Karl DeSaulniers  wrote:
> I will try that and let you know.

I just found another bug. :/

This line:

var progress : Number = framesElapsed / fadeDuration;

should really be like this:

var progress : Number = framesElapsed++ / fadeDuration;

otherwise there wouldn't be a fade. Sorry for that.

> One question, sort of off-sub, but in regards to what you just wrote.
> When you "delete" something does this remove it completely?
> or would it be available if that frame was played again?

If the code on that page would play again, then the "onEnterFrame =
..." part would get executed again, and the function would get
reassigned to onEnterFrame. It would also reset the framesElapsed
counter, so it wouldn't work if executed each frame.
So, run it only once. If you have to run it more than once, it gets
complicated. Let me know if that's the case.

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


Re: [Flashcoders] Operator Help!!

2009-05-21 Thread Mark Winterhalder
Oh, I forgot to remove the onEnterFrame when it's no longer needed.
Please add this line to the end of the function:

if( progress >= 1 ) delete this.onEnterFrame;

Mark


On Fri, May 22, 2009 at 12:18 AM, Mark Winterhalder  wrote:
> On Thu, May 21, 2009 at 11:44 PM, Karl DeSaulniers  
> wrote:
>> Oh no, I am just wanting to check what time of day it is and have my
>> background fade from dark to light accordingly.
>> The code you supplied, I think will do that, just haven't got off work yet
>> to try out. :)
>
> Well, it fades out for 12h, then fades back in for 12h, beginning at
> 6am each day.
>
> But now I think I really know what you mean. We can recycle most of the lines:
>
> var sunrise : Number = 6; // hour of day when sun begins to rise
> var fadeDuration = 100; // as number of frames
>
> var framesElapsed : Number = 0;
> var minutesPerDay : Number = 24 * 60;
> var time : Date = new Date();
> var minuteOfDay : Number = time.getHours() * 60 + time.getMinutes();
> var deltaMinutes : Number = (minuteOfDay - sunrise * 60 +
> minutesPerDay) % minutesPerDay;
> var cycleElapsed : Number = deltaMinutes / minutesPerDay; // [0...1[
>
> BKGND.BKGND_Grad.onEnterFrame = function () {
>   var progress : Number = framesElapsed / fadeDuration;
>
>   // here we check if the sun is supposed to set or to rise:
>   if( cycleElapsed < .5 ) {
>      // the sun is still rising
>      this._alpha = (1 - progress) * 100;
>   } else {
>      // the sun is setting
>      this._alpha = progress * 100;
>   }
> };
>
>> I am more so wanting to know why, if my code is correct, why its throwing
>> this operand error.
>> very mysterious and bugging me to no end :-P
>
> Yeah, I'd like to know that, too. Possibly, closing and restarting
> Flash will fix it? It has its mysterious ways sometimes, at least
> that's how it used to be. :/
>
> Mark
>

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


Re: [Flashcoders] Operator Help!!

2009-05-21 Thread Mark Winterhalder
On Thu, May 21, 2009 at 11:44 PM, Karl DeSaulniers  wrote:
> Oh no, I am just wanting to check what time of day it is and have my
> background fade from dark to light accordingly.
> The code you supplied, I think will do that, just haven't got off work yet
> to try out. :)

Well, it fades out for 12h, then fades back in for 12h, beginning at
6am each day.

But now I think I really know what you mean. We can recycle most of the lines:

var sunrise : Number = 6; // hour of day when sun begins to rise
var fadeDuration = 100; // as number of frames

var framesElapsed : Number = 0;
var minutesPerDay : Number = 24 * 60;
var time : Date = new Date();
var minuteOfDay : Number = time.getHours() * 60 + time.getMinutes();
var deltaMinutes : Number = (minuteOfDay - sunrise * 60 +
minutesPerDay) % minutesPerDay;
var cycleElapsed : Number = deltaMinutes / minutesPerDay; // [0...1[

BKGND.BKGND_Grad.onEnterFrame = function () {
   var progress : Number = framesElapsed / fadeDuration;

   // here we check if the sun is supposed to set or to rise:
   if( cycleElapsed < .5 ) {
  // the sun is still rising
  this._alpha = (1 - progress) * 100;
   } else {
  // the sun is setting
  this._alpha = progress * 100;
   }
};

> I am more so wanting to know why, if my code is correct, why its throwing
> this operand error.
> very mysterious and bugging me to no end :-P

Yeah, I'd like to know that, too. Possibly, closing and restarting
Flash will fix it? It has its mysterious ways sometimes, at least
that's how it used to be. :/

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


Re: [Flashcoders] Operator Help!!

2009-05-21 Thread Mark Winterhalder
Hmm... maybe I misunderstood what you were trying to do.

Do you want to have a continuous sunrise and -set over 24h, or do you
want to have a sudden sunset or -rise twice a day?

Mark


On Thu, May 21, 2009 at 10:57 PM, Mark Winterhalder  wrote:
> On Thu, May 21, 2009 at 10:43 PM, Karl DeSaulniers  
> wrote:
>> Thanks Mark.
>> That is an interesting approach.
>> Pardon me for asking, but what part in your code initiates the sunset part?
>
> Nothing really, if you mean how the change is triggered. But whenever
> the code runs, it will adjust the alpha.
> For testing, you can put all of it into an onEnterFrame(), but for
> production use you should run it only once when the page loads. If you
> really expect visitors to spend hours on your site, then use
> setInterval() to update it every couple of minutes.
>
> The general idea of the code is to calculate what fraction of 12h the
> current time is away from the begin of sunset, and then adjust the
> alpha accordingly. So, "sunset" here really means that it's the
> darkest minute of the day, just when it begins to get brighter.
>
> Mark
>
>
>> Karl
>>
>> Sent from losPhone
>>
>> On May 21, 2009, at 3:34 PM, Mark Winterhalder  wrote:
>>
>>> Hi,
>>>
>>> I *think* this does what you're trying to do, which would be to fade
>>> the alpha of an image in and out again over 24h. I don't have AS2 so I
>>> can't test, but when you do, you can set minutesPerDay to however long
>>> you may wish to sit there and watch the magic happen. If it happens,
>>> that is, because as I said it's untested.
>>> Please, reconsider putting it into an enterFrame handler. It's really
>>> enough to run it every couple of minutes.
>>>
>>> Also, no, unfortunately I have no idea why Flash is acting up for you.
>>> The operator use appears to be correct.
>>>
>>>
>>> var sunrise : Number = 6; // hour of day when sun begins to rise
>>> var maxAlpha : Number = 100;
>>>
>>> var minutesPerDay : Number = 24 * 60;
>>> var time : Date = new Date();
>>> var minuteOfDay : Number = time.getHours() * 60 + time.getMinutes();
>>> var deltaMinutes : Number = (minuteOfDay - sunrise * 60 +
>>> minutesPerDay) % minutesPerDay;
>>> var cycleElapsed : Number = deltaMinutes / minutesPerDay; // [0...1[
>>> var alpha : Number = Math.abs( 0.5 - cycleElapsed ) * 2 * maxAlpha;
>>>
>>> BKGND.BKGND_Grad._alpha = alpha;
>>>
>>>
>>> HTH,
>>> Mark
>>>
>>>
>>>
>>>
>>> On Thu, May 21, 2009 at 7:14 AM, Karl DeSaulniers 
>>> wrote:
>>>>
>>>> EEEk.. anyone!!!
>>>>
>>>> What am I doing wrong?? This is AS2.
>>>>
>>>> var sunrise:Array = new Array("6", "7", "8", "9", "10", "11", "12", "13",
>>>> "14", "15", "16", "17");
>>>> var sunset:Array = new Array("18", "19", "20", "21", "22", "23", "0",
>>>> "1",
>>>> "2", "3", "4", "5");
>>>>
>>>> var time:Date = new Date();
>>>> var hour:Number = time.getHours();
>>>> var hours:String = hour.toString();
>>>> var snRSE:String = sunrise[hours];
>>>> var snSET:String = sunset[hours];
>>>>
>>>> this.onEnterFrame = function() {
>>>>       if (hours == snRSE) {
>>>>               BKGND.BKGND_Grad._alpha -= BKGND.BKGND_Grad._alpha +
>>>> 8.333;
>>>>       } else if (hours == snSET) {
>>>>               BKGND.BKGND_Grad._alpha += BKGND.BKGND_Grad._alpha +
>>>> 8.333;
>>>>       }
>>>> };
>>>>
>>>> I feel this is probably so easy, but it is eluding me for some reason.
>>>> flash says for this line:
>>>>
>>>> if (hours == snRSE) {
>>>>
>>>>  - "operator "=" must be followed by an Operand" ???
>>>>
>>>>
>>>> Karl DeSaulniers
>>>> Design Drumm
>>>> http://designdrumm.com
>>>>
>>>> ___
>>>> Flashcoders mailing list
>>>> Flashcoders@chattyfig.figleaf.com
>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>
>>>
>>> ___
>>> Flashcoders mailing list
>>> Flashcoders@chattyfig.figleaf.com
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>> ___
>> 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] Operator Help!!

2009-05-21 Thread Mark Winterhalder
On Thu, May 21, 2009 at 10:43 PM, Karl DeSaulniers  wrote:
> Thanks Mark.
> That is an interesting approach.
> Pardon me for asking, but what part in your code initiates the sunset part?

Nothing really, if you mean how the change is triggered. But whenever
the code runs, it will adjust the alpha.
For testing, you can put all of it into an onEnterFrame(), but for
production use you should run it only once when the page loads. If you
really expect visitors to spend hours on your site, then use
setInterval() to update it every couple of minutes.

The general idea of the code is to calculate what fraction of 12h the
current time is away from the begin of sunset, and then adjust the
alpha accordingly. So, "sunset" here really means that it's the
darkest minute of the day, just when it begins to get brighter.

Mark


> Karl
>
> Sent from losPhone
>
> On May 21, 2009, at 3:34 PM, Mark Winterhalder  wrote:
>
>> Hi,
>>
>> I *think* this does what you're trying to do, which would be to fade
>> the alpha of an image in and out again over 24h. I don't have AS2 so I
>> can't test, but when you do, you can set minutesPerDay to however long
>> you may wish to sit there and watch the magic happen. If it happens,
>> that is, because as I said it's untested.
>> Please, reconsider putting it into an enterFrame handler. It's really
>> enough to run it every couple of minutes.
>>
>> Also, no, unfortunately I have no idea why Flash is acting up for you.
>> The operator use appears to be correct.
>>
>>
>> var sunrise : Number = 6; // hour of day when sun begins to rise
>> var maxAlpha : Number = 100;
>>
>> var minutesPerDay : Number = 24 * 60;
>> var time : Date = new Date();
>> var minuteOfDay : Number = time.getHours() * 60 + time.getMinutes();
>> var deltaMinutes : Number = (minuteOfDay - sunrise * 60 +
>> minutesPerDay) % minutesPerDay;
>> var cycleElapsed : Number = deltaMinutes / minutesPerDay; // [0...1[
>> var alpha : Number = Math.abs( 0.5 - cycleElapsed ) * 2 * maxAlpha;
>>
>> BKGND.BKGND_Grad._alpha = alpha;
>>
>>
>> HTH,
>> Mark
>>
>>
>>
>>
>> On Thu, May 21, 2009 at 7:14 AM, Karl DeSaulniers 
>> wrote:
>>>
>>> EEEk.. anyone!!!
>>>
>>> What am I doing wrong?? This is AS2.
>>>
>>> var sunrise:Array = new Array("6", "7", "8", "9", "10", "11", "12", "13",
>>> "14", "15", "16", "17");
>>> var sunset:Array = new Array("18", "19", "20", "21", "22", "23", "0",
>>> "1",
>>> "2", "3", "4", "5");
>>>
>>> var time:Date = new Date();
>>> var hour:Number = time.getHours();
>>> var hours:String = hour.toString();
>>> var snRSE:String = sunrise[hours];
>>> var snSET:String = sunset[hours];
>>>
>>> this.onEnterFrame = function() {
>>>       if (hours == snRSE) {
>>>               BKGND.BKGND_Grad._alpha -= BKGND.BKGND_Grad._alpha +
>>> 8.333;
>>>       } else if (hours == snSET) {
>>>               BKGND.BKGND_Grad._alpha += BKGND.BKGND_Grad._alpha +
>>> 8.333;
>>>       }
>>> };
>>>
>>> I feel this is probably so easy, but it is eluding me for some reason.
>>> flash says for this line:
>>>
>>> if (hours == snRSE) {
>>>
>>>  - "operator "=" must be followed by an Operand" ???
>>>
>>>
>>> Karl DeSaulniers
>>> Design Drumm
>>> http://designdrumm.com
>>>
>>> ___
>>> Flashcoders mailing list
>>> Flashcoders@chattyfig.figleaf.com
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>
>>
>> ___
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> ___
> 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] Operator Help!!

2009-05-21 Thread Mark Winterhalder
Hi,

I *think* this does what you're trying to do, which would be to fade
the alpha of an image in and out again over 24h. I don't have AS2 so I
can't test, but when you do, you can set minutesPerDay to however long
you may wish to sit there and watch the magic happen. If it happens,
that is, because as I said it's untested.
Please, reconsider putting it into an enterFrame handler. It's really
enough to run it every couple of minutes.

Also, no, unfortunately I have no idea why Flash is acting up for you.
The operator use appears to be correct.


var sunrise : Number = 6; // hour of day when sun begins to rise
var maxAlpha : Number = 100;

var minutesPerDay : Number = 24 * 60;
var time : Date = new Date();
var minuteOfDay : Number = time.getHours() * 60 + time.getMinutes();
var deltaMinutes : Number = (minuteOfDay - sunrise * 60 +
minutesPerDay) % minutesPerDay;
var cycleElapsed : Number = deltaMinutes / minutesPerDay; // [0...1[
var alpha : Number = Math.abs( 0.5 - cycleElapsed ) * 2 * maxAlpha;

BKGND.BKGND_Grad._alpha = alpha;


HTH,
Mark




On Thu, May 21, 2009 at 7:14 AM, Karl DeSaulniers  wrote:
> EEEk.. anyone!!!
>
> What am I doing wrong?? This is AS2.
>
> var sunrise:Array = new Array("6", "7", "8", "9", "10", "11", "12", "13",
> "14", "15", "16", "17");
> var sunset:Array = new Array("18", "19", "20", "21", "22", "23", "0", "1",
> "2", "3", "4", "5");
>
> var time:Date = new Date();
> var hour:Number = time.getHours();
> var hours:String = hour.toString();
> var snRSE:String = sunrise[hours];
> var snSET:String = sunset[hours];
>
> this.onEnterFrame = function() {
>        if (hours == snRSE) {
>                BKGND.BKGND_Grad._alpha -= BKGND.BKGND_Grad._alpha +
> 8.333;
>        } else if (hours == snSET) {
>                BKGND.BKGND_Grad._alpha += BKGND.BKGND_Grad._alpha +
> 8.333;
>        }
> };
>
> I feel this is probably so easy, but it is eluding me for some reason.
> flash says for this line:
>
> if (hours == snRSE) {
>
>  - "operator "=" must be followed by an Operand" ???
>
>
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>

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


Re: [Flashcoders] Math: Is this correct?

2009-04-11 Thread Mark Winterhalder
On Sat, Apr 11, 2009 at 5:57 PM, Jer Brand  wrote:
> Thanks Mark, Gonna go read with the faq's.  And you hit the nail on the
> head. It looked right, but the behavior wasn't quite right

There's a picture on the Wikipedia page, just look at where the axis'
go and replace x, y and z with where they go in your coordinate
system.

> Time to learn some vector math I suppose. Thanks again everyone. I hafta
> wonder if it'd be easier if I just made the day job pay for a few math
> courses, I work on campus, so it's not like it'd cost em.

I'm not going to argue that a formal math course is a bad idea, it
certainly would be valuable and be a better foundation than a random
web tutorial. However... formal math courses are very, well, formal.
:)
The way I see it, to simply go through an online tutorial would be
more pragmatic. All you need are two or three dimensions, not a
general definition. Frankly, it's usually enough to have heard
something before so you know it's there and can look it up when you
need it.
Then again, if the course would be during work hours, then why not
follow up with one after you've got a basic understanding.

Of course, those on the list with a formal math background will disagree. :)

Mark

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


Re: [Flashcoders] Math: Is this correct?

2009-04-11 Thread Mark Winterhalder
On Fri, Apr 10, 2009 at 4:52 PM, Jer Brand  wrote:
> Anyone care to school me on this or confirm the math is correct?

It looks correct to me.

> public static function polarToCartesian3D(distance:Number, degrees1:Number,
> degrees2:Number ):Point3D

Ah, that's your problem right there -- your code converts /Spherical/
coordinates to Cartesian, not /Polar/ coordinates... :)

Seriously, though, it's correct. The ever knowing Wikipedia agrees
with you, too:


However, your axis might not align to the coordinate system your code
(and Wikipedia) assumes, which might explain unexpected but
almost-right looking behaviour. I usually use X right, Y down and Z
into the screen, because that seems like the natural way for screen
coordinates. If that's what you're using, then you have to rearrange
the math in your code accordingly, i.e, swap the x, y and z around to
make it fit.

If you want to get into that, I recommend you refresh your vector math
skills and have another look at matrix math. You'll need that all the
time. It's actually not that difficult, and it doesn't require
anything but very basic prior math knowledge to get into. There are
many vector math tutorials on the web.

Finally, despite of Wikipedia and Math World, I still find those two
ugly text based old skool Usenet FAQs invaluable:



They'll answer pretty much any question you could possibly have.

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


Re: [Flashcoders] Bitwise selection

2009-04-03 Thread Mark Winterhalder
On Fri, Apr 3, 2009 at 8:38 AM, Jiri  wrote:
> So each element in a ByteArray can hold 8 bits.
> What about the readInt() method of the ByteArray, does an integer then span
> over 4 elements of the bytearray. And if I start at position 0 and then call
> the readInt(), is the position after that then 4?

Yes, and you can use readUnsignedByte(), too, for example, but if
you're trying to use a ByteArray to store bit flags, then we can
probably help you find a more elegant way to do what you want.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Bitwise selection

2009-04-02 Thread Mark Winterhalder
Jiri,

if() isn't too bad, especially since you will possibly want to permit
multiple restrictions (like numbers /and/ letters, or Latin letters
plus umlauts). If you use if() and combine that with appending to the
restriction instead of setting it (+= instead of =), you gain
flexibility. That way, you could also split lower case and upper case
letter restrictions, and introduce a case insensitive restriction that
is set to (UPPER_CASE | LOWER_CASE) -- it would have both bits set, so
it would "hit" for both tests and append the restrictions to the "a-z
A-Z " you already have now. That's just one example, the idea is not
to have a fixed number of selections, but "groups" that you can switch
on bit by bit, plus some predefined combinations (like the case
insensitive letter example) for convenience.

Also, don't test (restriction & 2), but (restriction & NUM_ONLY). That
way, it's more readable, and you don't have to change all 2s if you
decide to reorder your flags. Even more pedantic :), test
((restriction & NUM_ONLY) == NUM_ONLY) so you don't run into problems
if you want to have flags that have multiple bits set later on.

 HTH,
Mark



On Thu, Apr 2, 2009 at 12:08 PM, Jiri  wrote:
> I am new to bitwise operators, so I am trying to learn it.
>
> I have the following code and it works half. I am using a switch case to get
> the result, but this is messing things up. I could revert to and if - else
> statement, but I was wondering if there is a more elagant way of doing it. I
> post my code below, and would have some advice.
>
> var NO_RESTRICTION:int = 1;
> var NUM_ONLY:int = 2;
> var CHAR_ONLY:int = 4;
>
> var RESTRICTION:int =  NUM_ONLY ;
>
> function setInputCharRestriction(tInt:int):void {
>        RESTRICTION = tInt | tInt&2 | tInt&3;
> }
>
> function getRestrict():String{
>                var tRestrict:String = '';
>
>                trace('all ' , Boolean(RESTRICTION&1))
>                trace('num ' , Boolean(RESTRICTION&2))
>                trace('char ' ,Boolean(RESTRICTION&4))
>
>                switch(RESTRICTION){
>                        case RESTRICTION&1 :
>                                tRestrict +="\u0020-\u007E";
>                                trace('all')
>                        case RESTRICTION&2:
>                                tRestrict =" 0-9";
>                                trace('num')
>                        case RESTRICTION&4:
>                                tRestrict =" A-Z a-z";
>                                trace('char')
>                }
>                trace('restrict field ' , tRestrict)
>                return tRestrict;
> }
>
> getRestrict()
>
> Thank you.
>
> Jiri
> ___
> 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] Intersection on circle based on angle

2009-03-17 Thread Mark Winterhalder
After seeing Jason's mail, I notice I should add that the angle is
supposed to be in radians (i.e., degrees / 180 * Math.PI). However, he
already provided a convenient set of functions, so you probably don't
need that anymore... :)

Mark


On Tue, Mar 17, 2009 at 3:50 PM, Mark Winterhalder  wrote:
> On Tue, Mar 17, 2009 at 2:17 PM, Eric E. Dolecki  wrote:
>> I've done this before but can't find my file(s). I am currently googling but
>> haven't found the answer yet (I'm sure it's out there, just need to
>> rediscover it).
>> I have a circle, registration at 0, 0.
>> If I have an angle from it's center, I'd like to get x,y where the angle
>> would intersect with the edge of the circle. I am basically drawing dots
>> around the outside of a circle (think mixing console knobs with a variable
>> number of detents).
>>
>> anyone have something handy?
>
> var x : Number = Math.cos( angle ) * radius;
> var y : Number = Math.sin( angle ) * radius;
>
> ...where the angle is measured from the positive X axis.
>
> This is from memory, it might go into the wrong direction. If so, then
> simply add a minus in front of the y calculation.
>
> Mark
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Intersection on circle based on angle

2009-03-17 Thread Mark Winterhalder
On Tue, Mar 17, 2009 at 2:17 PM, Eric E. Dolecki  wrote:
> I've done this before but can't find my file(s). I am currently googling but
> haven't found the answer yet (I'm sure it's out there, just need to
> rediscover it).
> I have a circle, registration at 0, 0.
> If I have an angle from it's center, I'd like to get x,y where the angle
> would intersect with the edge of the circle. I am basically drawing dots
> around the outside of a circle (think mixing console knobs with a variable
> number of detents).
>
> anyone have something handy?

var x : Number = Math.cos( angle ) * radius;
var y : Number = Math.sin( angle ) * radius;

...where the angle is measured from the positive X axis.

This is from memory, it might go into the wrong direction. If so, then
simply add a minus in front of the y calculation.

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


Re: [Flashcoders] Advanced Rollover Physics/Math...

2009-02-12 Thread Mark Winterhalder
Hah, that reminds of of the classic Yugop site, back during Flash 4
days -- the one with the rotating cube preloader, the "older"
generation among us might remember...

What you're actually trying to do is a bit different, though. When you
think about it, it's not unlike a tree-map, where you add weight to
the node the mouse is over, and subtract from the others.



HTH,
Mark



On Thu, Feb 12, 2009 at 2:03 PM, Sander Schuurman
 wrote:
> Hi cool list...
>
> I'm trying to create a subtle/smooth rollover animation of elements that 
> react (scale) to the mouse position, and are aware of each other, so they 
> move out of the way for each other instead of overlapping.
>
> I came across this subject a couple of times on the internet, but I can't 
> find it with google anymore.
>
> The following image explains the simple subject:
> http://img209.imageshack.us/img209/7434/testuu7.gif
>
> The following image explains more what I want design-wise:
> http://img165.imageshack.us/img165/5407/test2ec9.gif
>
> Somebody who can point me in the right direction?
>
> Can I do this with a physics-engine? Without gravity, but with the awareness 
> of the other elements?
>
> How would you do it?
>
> Thanks!
> ___
> 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] Converting hex colour numbers back and forth

2009-02-09 Thread Mark Winterhalder
On Mon, Feb 9, 2009 at 6:26 PM, ali drongo  wrote:
> currColor = Number("0x"+c);

I haven't looked into it in detail, but I think you would want to use
parseInt( "0x" + c, 16 ) here.
If that doesn't fix it, try tracing the values throughout your
conversion and see where it breaks.

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


Re: [Flashcoders] Either an incredibly easy or incredibly difficult problem

2009-02-09 Thread Mark Winterhalder
On Mon, Feb 9, 2009 at 7:47 PM, Todd Kerpelman  wrote:
> Hey, coders!
>
> I have a Sprite that consists of a polygon that I drew in Flash (using the
> line tool) and saved into my Library.
>
> Using ActionScript, is there any way to easily find the points of said
> polygon? It seems like I oughta be able to dig up those line coordinates out
> of my Sprite.graphics object, but I can't seem to find a way of doing it...

You'll end up reading the coordinates from inside the Flash IDE or by
using a tool like Swfmill, but just for sports, and with the
limitation that it needs to be convex, this is the easiest way I can
think of:

Rotate it slowly. Use getRect to find out how far it extends towards,
say, the right, at a given rotation. When that distance decreases,
it's a point, and you can calculate its coordinate via the distance
and rotation. Repeat until you've made a full turn.

If it's not convex, I guess you'd need to trace it...

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


Re: [Flashcoders] Dictionary resource for word based games

2009-01-09 Thread Mark Winterhalder
Also check Project Gutenberg:
<http://www.gutenberg.org/>

Search "dictionary" in the title, several potential candidates will
come up. They probably require some parsing, and will also lack modern
words, but they're Free.

Mark



On Fri, Jan 9, 2009 at 1:24 PM, Mark Winterhalder  wrote:
> On Fri, Jan 9, 2009 at 11:25 AM, Paul Steven  
> wrote:
>> Can anyone point me in
>> the direction of where to acquire an electronic version of the English
>> dictionary that is easily incorporated into my game?
>
> Sure: <http://download.wikimedia.org/enwiktionary/latest/>
> It's under the GNU Free Documentation License, not sure how that
> applies to what you're trying to do. In any case, as all the other
> Wikimedia/Wikipedia projects, it's an interesting dataset.
>
> HTH,
> Mark
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Dictionary resource for word based games

2009-01-09 Thread Mark Winterhalder
On Fri, Jan 9, 2009 at 11:25 AM, Paul Steven  wrote:
> Can anyone point me in
> the direction of where to acquire an electronic version of the English
> dictionary that is easily incorporated into my game?

Sure: 
It's under the GNU Free Documentation License, not sure how that
applies to what you're trying to do. In any case, as all the other
Wikimedia/Wikipedia projects, it's an interesting dataset.

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


Re: [Flashcoders] ActionScript syntax enhancements?

2009-01-08 Thread Mark Winterhalder
On Thu, Jan 8, 2009 at 1:35 PM, Merrill, Jason
 wrote:
> 2.  Time it can take to learn something like haxe doesn't seem to give you 
> enough ROI - at least my impression having looked at haxe as an alternative.

I have to disagree here -- learning haXe has definitely payed off for
me, and I very much enjoy using it. There are several reasons, from
performance over convenience to features like generics that helped me
to learn to think differently.
The difference is that haXe has some radical improvements that (IMHO)
outweigh the disadvantages of breaking compatibility with the sources
the rest of the community produces. Also, as I already mentioned, it
can generate AS3, and you can still use third-party libraries (it
automatically generates the headers for you).

The problem I'm having is with minor changes for convenience, for the
reasons you listed. But, if there's no lock-in and sources can be
"standardized" easily, then it could be a valuable alternative.
Otherwise, yeah, those would be the roadblocks that would slow or even
limit acceptance.

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


Re: [Flashcoders] ActionScript syntax enhancements?

2009-01-07 Thread Mark Winterhalder
I think another compiler with a focus on more efficient bytecode would
be great, but those extra convenience features give me an uneasy
feeling ("embrace and extend" has caused too many problems already).

So, my feature request would be an export functionality to remove all
those extra features from the code, where all comments and formatting
would be kept intact, and a --vanilla compiler setting that enforces
compliance with "standard" Adobe AS3 (better yet, a required
--convenient setting to enable them). That way, there would be no fear
of vendor lock-in or compatibility issues.
Also, it might be a good idea to have a special suffix to indicate
that it's "special" AS3 -- maybe some possible acronym for "Action
Script Special". :)

haXe has an AS3 generator for that very reason.

But, those fears aside, would it be possible to build on the work that
was done for Alchemy and use LLVM to generate the bytecode? AFAIK, it
has very good optimization already. According to the third post in
this thread, it should be possible to use normal LLVM with AlchemyÄs
llc binary:


Mark



On Wed, Jan 7, 2009 at 5:28 PM, Matthias Kramm  wrote:
> On Wed, Jan 07, 2009 at 09:27:06AM -0500, Merrill, Jason 
>  wrote:
>> You may want to look at the haxe language and compiler which already
>> does what you're trying to do and see if you can compete with that
>
> haxe is a nifty project. But they're inventing their own language,
> which is only similar to (and not quite identical with) ActionScript.
>
> My goal is to be fully compatible with the ActionScript
> compiler in Flash CS4 and Flex, but hopefully produce smaller output files
> (Flex's code generator, in particular, is producing somewhat bloated
>  bytecode right now) and also offer the aforementioned syntax enhancements.
>
> Btw.: Thanks for all the great suggestions so far!
>
> Greetings
>
> Matthias
>
> ___
> 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] AS3 Minimal Class Props + Methods ...

2008-09-03 Thread Mark Winterhalder
On Wed, Sep 3, 2008 at 10:36 AM, S0 F1 <[EMAIL PROTECTED]> wrote:
> Does anyone know how to find out the bare minumum Attributes and Methods of
> all built-in/intrinsic Classes being used in a SWF/AS3 application.
>
> Something perhaps that can parse a SWF, identify what intrinsic classes are
> being used and what is redundant or could be stripped out of those classes?
>
> Asking this from the point of view of optimising filesize/performance?

Intrinsics are built into the player, they're not part of the SWF. In
the SWF you'll only find the strings to identify them with, and you
can't go without those anyway.

If you want to know which intrinsics are referenced in an SWF,
Swfdump, Swfmill etc will be able to help. They're right at the
beginning of the dump, but connecting the class- to the package names
will require some work.

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


Re: [Flashcoders] Singleton lookups vs Events ...

2008-09-03 Thread Mark Winterhalder
Performance optimization is nice and all, but... how often will that
happen in a frame? Once? A few hundred times? Then go with whatever is
the easiest to understand, because you're still at fractions of a
milisecond. Try it -- just time how long it takes to call a
getInstance method a few thousand times or send as many events. I'd
expect the Singletons to be slightly faster, especially if a new event
object would have to be instantiated each time, but then, I don't see
the relation between them and events. Perhaps you could give an
example of a situation where both would be equaly valid options?

If you have a situation where it would actually make a measurable
difference in performance, then you'd probably want to go without any
of the two.

Mark



On Wed, Sep 3, 2008 at 3:16 PM, S0 F1 <[EMAIL PROTECTED]> wrote:
> Any thoughts on whether it's more efficient (in terms of development and
> player performance) to use Singleton's (with static public 'getInstance' or
> such) instead of Event's when developing mid-sized applications? (for
> classes that *are* Singleton's of course). Asking this in regards to when
> you know no other class needs notification.
>
> It seems a lot cleaner in terms of code (not having to create and listen for
> events). Just a direct call - but what about performance speed, etc.
>
> Is this good practice.
>
> Cheers.
> ___
> 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] Scaling a Parallelogram

2008-08-31 Thread Mark Winterhalder
I knew I'd find a mistake when I hit send. :|

If the upper and lower edge are parallel to the X axis, then obviously
you can use three /vertical/ strips, scale the middle part, and move
the right strip.

Mark



On Sun, Aug 31, 2008 at 6:49 PM, Mark Winterhalder <[EMAIL PROTECTED]> wrote:
> Matt,
>
> if I understand you correctly, then this is only possible for
> parallelograms that have sides perpendicular to the axis you want to
> scale along to, i.e., parallel to the Y axis in your case. You will
> always change the slope of a line that is not parallel to one of the
> axis if you scale a clip to something where scaleX != scaleY, and thus
> distort any angles.
>
> /If/ the left and right edges of your parallelogram are parallel to
> the Y axis, then you can cut it into three horizontal strips. So, the
> upper and lower strip would contain the diagonal sides and parts of
> the (strictly vertical) right and left edges. The middle strip would
> only contain the middle parts of the left and right edges and no
> angles.
> To scale that parallelogram along the X axis, you increase the scaleX
> and scaleY of the outer strips and the scaleX of the middle strip by
> an equal amount, and reduce the height of the middle strip by what the
> outer two gained to compensate for the vertical growth (simply set it
> to desiredHeight - upperStrip.height - lowerStrip.height.) You can
> avoid relocation math by having the control point of the lower strip
> at the bottom left, and the one of the middle trip at center left.
> That way, the total width of the parallelogram increases, the height
> remains constant, and your angles are maintained.
>
> Mark
>
>
>
>
> On Sun, Aug 31, 2008 at 3:06 PM, Matt S. <[EMAIL PROTECTED]> wrote:
>> So I have a parallelogram (
>> http://thesaurus.maths.org/mmkb/media/png/AreaofParallelogram.png )
>> which I need to scaleX up from 1 to 50, while maintaining the angles
>> of the sides . The problem of course is that just increasing scaleX
>> will cause the angles to distort. I cant use scale9 because the
>> parallelogram needs to start as a 5 pixel sliver, which means the
>> angled parts would overlap at the smallest state. I'm thinking I might
>> need to dynamically draw it on enterFrame, deleting and redrawing each
>> time, but perhaps someone has a better suggestion? Imagine a
>> parallelogram that starts out at 5 pixels wide and height=stageHeight,
>> and expands horizontally to a width of stageWidth, without losing the
>> angles on the sides. Any suggestions much appreciated.
>>
>> tia,
>>
>> .m
>> ___
>> 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] Scaling a Parallelogram

2008-08-31 Thread Mark Winterhalder
Matt,

if I understand you correctly, then this is only possible for
parallelograms that have sides perpendicular to the axis you want to
scale along to, i.e., parallel to the Y axis in your case. You will
always change the slope of a line that is not parallel to one of the
axis if you scale a clip to something where scaleX != scaleY, and thus
distort any angles.

/If/ the left and right edges of your parallelogram are parallel to
the Y axis, then you can cut it into three horizontal strips. So, the
upper and lower strip would contain the diagonal sides and parts of
the (strictly vertical) right and left edges. The middle strip would
only contain the middle parts of the left and right edges and no
angles.
To scale that parallelogram along the X axis, you increase the scaleX
and scaleY of the outer strips and the scaleX of the middle strip by
an equal amount, and reduce the height of the middle strip by what the
outer two gained to compensate for the vertical growth (simply set it
to desiredHeight - upperStrip.height - lowerStrip.height.) You can
avoid relocation math by having the control point of the lower strip
at the bottom left, and the one of the middle trip at center left.
That way, the total width of the parallelogram increases, the height
remains constant, and your angles are maintained.

Mark




On Sun, Aug 31, 2008 at 3:06 PM, Matt S. <[EMAIL PROTECTED]> wrote:
> So I have a parallelogram (
> http://thesaurus.maths.org/mmkb/media/png/AreaofParallelogram.png )
> which I need to scaleX up from 1 to 50, while maintaining the angles
> of the sides . The problem of course is that just increasing scaleX
> will cause the angles to distort. I cant use scale9 because the
> parallelogram needs to start as a 5 pixel sliver, which means the
> angled parts would overlap at the smallest state. I'm thinking I might
> need to dynamically draw it on enterFrame, deleting and redrawing each
> time, but perhaps someone has a better suggestion? Imagine a
> parallelogram that starts out at 5 pixels wide and height=stageHeight,
> and expands horizontally to a width of stageWidth, without losing the
> angles on the sides. Any suggestions much appreciated.
>
> tia,
>
> .m
> ___
> 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] A Question that I've been asking for years!!

2008-08-26 Thread Mark Winterhalder
I think Hans (and Claus ;) explained it very well, so just to
reiterate, sometimes it's just useful to specify methods instead of
ancestors as an argument type.

For an example, have a look at flash.utils.IDataInput. It's
implemented by ByteArray, Socket and URLStream. Obviously, a ByteArray
and a Socket don't have much in common, in terms of how they do their
thing, but they both are used to read (and write) data. Often, that's
all you need to know.

Say you write a class that draws a pretty chart. It has a method that
reads a series of values by repeatedly calling readInt(), which is
guaranteed by IDataInput, and draws that data. If your method takes a
ByteArray, it works fine for preloaded or locally stored data. If it
takes a Socket, it works for a live data stream off the net. But if it
takes an IDataInput, it can do both, without any additional effort --
you pass it a /data source/, and decide at runtime where you get it
from.

Another example could be some code that calculates the distance
between two coordinates. It takes two objects that both have an x and
a y property. You'd use essentially the same code to calculate the
distance between Points or Sprites, but you'd have to write two
methods: There is no ICoordinate interface (requiring an x and y
property) that they could implement. If there was, you'd only need one
method to do it, and on top of that it could also calculate the
distance between a Point and a Sprite, as a free bonus.
(Calculating a distance may seem like a trivial example, but it could
also be, say, a quad tree for hit testing.)

To solve Hans' adapter problem, you'd use the IContinentalOutlet
interface, which is required by his continental player to work. The
various adapters he collected during his travels all look different
and even are from different vendors. But they all implement the
IContinentalOutlet interface, /how/ they do it doesn't matter.

You don't have to work in a team to appreciate interfaces. They simply
make code more flexible, that's a good thing, use them where
appropriate (I'd even go as far and say "when in doubt, use an
interface").

Mark




On Tue, Aug 26, 2008 at 12:44 PM, Hans Wichman
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> interfaces are pretty simple in reality and they are everywhere.
> Imagine every wall outlet looked different, and not only different, but that
> in order to use them, you had to remove the outlet first, take a look at the
> wiring and then bolt it back on with you finally knowing how to use it.
>
> Would we accept that as a fact of life? No sir.
> So what would we do?
>
> We'd come up with a brilliant plan to take over the world, and it involves
> agreeing on what a wall outlet looks like and what we expect it to do. So no
> matter the device I want to plug in, as long as my device agrees with the
> interface it has been offered, it's good to go.
>
> Will it work without problems everywhere and always? Nah try to plug in your
> dutch mp3player in the uk, no go, but within a certain context they can work
> wonders.
>
> hth :)
> JC
>
> On Tue, Aug 26, 2008 at 9:49 AM, Cor <[EMAIL PROTECTED]> wrote:
>
>> Very good, Claus,
>>
>> Do you have a visual of this... LOL
>>
>> Regards
>> Cor
>>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:
>> [EMAIL PROTECTED] On Behalf Of Claus Wahlers
>> Sent: dinsdag 26 augustus 2008 9:42
>> To: Flash Coders List
>>  Subject: Re: [Flashcoders] A Question that I've been asking for years!!
>>
>> An example is worth a thousand words.
>>
>> public interface IBounce {
>>function bounce():void;
>> }
>>
>> public class Balls implements IBounce {
>>public function bounce():void { }
>> }
>>
>> public class Boobs implements IBounce {
>>public function bounce():void { }
>> }
>>
>> var balls:Balls = new Balls();
>> var boobs:Boobs = new Boobs();
>> doSomethingWith(balls);
>> doSomethingWith(boobs);
>>
>> function doSomethingWith(bouncyObject:IBounce):void {
>>bouncyObject.bounce();
>> }
>>
>> Cheers,
>> Claus.
>>
>> Omar Fouad wrote:
>>
>> > This could seem weird...
>> > But what the hell is an interface!!! I've read lots of books and
>> > posts without getting the answer. I bought "Essential AS3" to read about
>> > interfaces and he says that helps for multi inheritance. In other places
>> I
>> > read that it is a "deal" to ensure that a class has some methods and so
>> on.
>> > But what is the real benefit that I can come out with using
>> interfaces
>> >
>> > Maybe that is stupidity or I am not smart enough to get the concept but
>> > believe me... its is been two years now!!
>> >
>> > Please Help!!!
>> >
>>
>>
>> ___
>> 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] Binary Data Question

2008-08-14 Thread Mark Winterhalder
On Thu, Aug 14, 2008 at 10:56 PM, Omar Fouad <[EMAIL PROTECTED]> wrote:
> You mean it is not the same bandwidith taken as when loading the picture
> from a directory in a server?

It's a different encoding. You could encode it to, say, png before
sending it back, or use zlib compression.

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


Re: [Flashcoders] Drawing an arc with curveTo

2008-08-03 Thread Mark Winterhalder
Hi Alias,

I'm not sure I understand what you mean by 'arc' -- isn't anything you
do with curveTo an arc?

If that helps, I have some related code attached that I wrote a while
ago. It's a bezier curve that you can drag directly to modify, i.e.,
not by moving the control point but holding on to the curve itself.
So, it contains the math to calculate/guess a point /on/ the curve and
its t (in the 0..1 range) from a given point /near/ the curve, and it
can calculate the required control point to give you a curve that goes
through a given point at a given t.

It's in haXe, but should translate very easily. BezierTest.hx is just
a hackish test, Bezier.hx contains the math -- moveControlPoint is
probably what you're looking for.

HTH,
Mark



On Sun, Aug 3, 2008 at 11:53 PM, Alias™ <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> Can anyone point me towards some info on how to draw a proper curved
> arc in actionscript using curveTo? I've seen plenty of stuff about how
> to draw an arc using loads of short lines, but that isn't really going
> to cut it - I need this to be efficient and look good.
>
> I believe the crux of the matter is working out the correct coords for
> the control points - is there any info on computing the curvature of a
> line segment on a quadratic bezier? Has anyone cracked this?
>
> Thanks in advance,
> Alias
> ___
> 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] faster, longer, better ... for programming maniaks

2008-07-30 Thread Mark Winterhalder
On Wed, Jul 30, 2008 at 11:02 PM, Juan Pablo Califano
<[EMAIL PROTECTED]> wrote:
> Check these slides:
>
> http://www.onflex.org/ACDS/AS3TuningInsideAVM2JIT.pdf
>
> >From page 43:
>
> * We make a simple "hotspot"-like decision about whether to interpret or JIT
> * Initialization functions ($init, $cinit) are interpreted
> * Everything else is JIT
> * Upshot: Don't put performance-intensive code in class initialization

Thanks for the link, but I was hoping for something more specific,
like an article that explains when the compilation happens. For
example, a method could be compiled initially, when it first runs, or
each time it gets called.

I'm just curious, it's not important to know.

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


Re: [Flashcoders] faster, longer, better ... for programming maniaks

2008-07-30 Thread Mark Winterhalder
> You clearly understand what I was saying, Mark, but just a brief
> reiteration: compiled ActionScript has to be interpreted by the VM, which is
> _always_ slower than compiling directly to machine language.

Yes, I understand and am not even disagreeing. :)

However, there have been benchmarks where Java was actually marginally
/faster/ than C++ for some specific tests. This seems
counterintuitive, but the JIT compiler knows more at runtime than the
traditional compiler can know in advance, and I'm guessing that's why
it can (not generally, but in some rare situations) do better
optimizations. When you have ideal programmers then of course compiled
languages will be faster, but that difference is getting less as
technology evolves.
But of course we're talking about the Flashplayer here, and size,
portability and start-up time are more important design goals than
execution speed, so we'll most definitely will always have to live
with a very noticeable performance penalty. Then again, we don't have
to manage memory ourselves, which is a big plus.
(Btw memory allocation and optimization: recycling instances where
possible is also a good idea.)

If somebody knows a good explanation about the when and how of the
AVM2 JIT compiler, I'd be curious. The same goes for a table that
shows relative performance of stuff the renderer does -- like with
alpha vs. without, if rendering time grows linear with the number of
pixels, how much time is wasted on DisplayObjects outside of the
visible Stage, stuff like that.

Mark





On Wed, Jul 30, 2008 at 9:05 PM, Kerry Thompson <[EMAIL PROTECTED]> wrote:
> Mark Winterhalder wrote:
>
>> Nitpicking, but just as anything digital the SWF opcodes essentially
>> are 1s and 0s, too. :)
>
> Fair enough. Following that to its logical conclusion, _everything_ on your
> computer is 1s and 0s, including the text in this email ^_^
>
> You clearly understand what I was saying, Mark, but just a brief
> reiteration: compiled ActionScript has to be interpreted by the VM, which is
> _always_ slower than compiling directly to machine language.
>
> When I was doing Director full time, I ran some tests that showed C++ to run
> up to 400 times as fast as Lingo. I lobbied for years to get a true
> machine-language compiler for Lingo, at least for desktop apps. I was struck
> by how few developers understood the implications, and without other
> developers clamoring for the need for speed, Macromedia never went there.
> Director could have been a major player in the 3D game world.
>
> And don't tell me that Director 3D is "fast enough". Hard-core gamers buy
> $8,000 machines to squeeze every last fps out of their games. With lights,
> shaders, high-poly objects, multiple cameras, Director is just not fast
> enough for a Quake or Doom LAN party. And, of course, neither is Flash.
>
>> Anyway, the new VM supports JIT compilation to native machine code. I
>> must admit I don't know if /all/ code gets JIT compiled or only
>> hotspots, and I don't know if it will be recompiled for each use to
>> "hardcode" variables, but that would also have implications.
>
> One major implication would be in loops. The complier would  have no way of
> knowing if an array would change length in a loop, for example, so it
> couldn't hard code the length.
>
> Cordially,
>
> Kerry Thompson
>
> ___
> 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] faster, longer, better ... for programming maniaks

2008-07-30 Thread Mark Winterhalder
Nitpicking, but just as anything digital the SWF opcodes essentially
are 1s and 0s, too. :)

Anyway, the new VM supports JIT compilation to native machine code. I
must admit I don't know if /all/ code gets JIT compiled or only
hotspots, and I don't know if it will be recompiled for each use to
"hardcode" variables, but that would also have implications.

Mark



On Wed, Jul 30, 2008 at 8:21 PM, Kerry Thompson <[EMAIL PROTECTED]> wrote:
> Juan Pablo Califano wrote:
>
>> If you mean decompiling the push method itself, you can't because it's not
>> actioscript but a native code, implemented directly in the player.
>
> Nice work, Juan Pablo.
>
> The code you have been posting prompts me to comment on the underlying
> mechanism of Flash. I know, from experience, that a lot of Flash coders (and
> Director, and Java) don't understand about bytecode vs. native code.
>
> If you're writing in a true compiled language like C++, your code will
> compile to machine language specific to your CPU. Machine code is 1's and
> 0's, the on/off switches that are the basis of any binary computer.
>
> Flash is cross-platform, though. It has to work on Intel processors,
> PowerPC, and others. It has to work on different OS's like Windows, Mac, and
> Unix. The machine code is different for every processor, and the
> implementation is specific to an OS. So, the Flash compiler can't compile to
> machine code.
>
> Instead, Macromedia, and now Adobe, have written a player for each of the
> supported platforms. The player is in machine code (ones and zeros), but our
> ActionScript code is not. ActionScript compiles to an intermediate bytecode,
> or token. The player reads these tokens, and executes the appropriate
> machine code.
>
> That's what makes Flash slower than C++, and also more secure--it's much
> more difficult to write malicious code if you don't have direct access to
> the machine, but have to go through an interpreter.
>
> This idea has been around for 25 years or so. The first implementation I
> used was UCSC Pascal, which, like Flash, compiled down to an intermediate
> token which was, in turn interpreted and executed by the player (we called
> it a "virtual machine" back then). It has only been in the last 10 years or
> so that machines have gotten fast enough to run this sort of code
> satisfactorily.
>
> If you understand this, you can find the bottlenecks in your code more
> easily, and optimize it. Loops are often the main culprit, as they have to
> interpret the bytecode each time through the loop. Also, if you're working
> with something with a fixed length like an array or XML nodes (really the
> same thing), it's faster if you store the length of the array in a register
> variable. An illustration:
>
> var arrLen:int;
> arrLen = myArray.length();
> for (var i:int; i < arrLen; i++)
>
> works faster than
> for (var i:int; i < myArray.length(); i++)
>
> Cordially,
>
> Kerry Thompson
>
> ___
> 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] When to use AS3?

2008-07-30 Thread Mark Winterhalder
On Wed, Jul 30, 2008 at 2:22 PM, Romuald Quantin
<[EMAIL PROTECTED]> wrote:
> Yeah true, or what's working as well is saying that AS2 code is harder to
> maintain and will cost you more money in the future.

Regarding the future argument, you can add that future versions of the
project could use future functionality that won't be available with
the old AS2 API. Also, ECMA262.v4/JS2/AS4/whatever will come not only
to the Flashplayer, and it will be much easier to reuse AS3 code.

Anyway, it's just one percent difference in penetration:


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


Re: [Flashcoders] faster, longer, better ... for programming maniaks

2008-07-30 Thread Mark Winterhalder
On Wed, Jul 30, 2008 at 5:44 PM, laurent <[EMAIL PROTECTED]> wrote:
>
> Can you decompile the push method to see how it use the stack ? :)

I take the :) you already know the answer, but just in case, it's
intrinsic and you can probably look the C++ code up in the Tamarin
sources.

I have to agree with Juan that you shouldn't take those results
seriously. The numbers are closer to each other than the margin of
error.
When I set up such a test (sorry, no code on this machine), I wait a
few frames so the player is fully initialized, and then run several
test of each variant. I take the best result and discard the rest --
the average or median are worthless, they just tell you how much other
processes on the system interfere with the test, and the worst tells
you if the garbage collector did its round.

In any case, don't go down the "X does Y the fastest, so I'll only use
X from now on" route. If you're writing some selected inner loops or a
math library, OK, but most of your code won't get executed thousands
of times each frame, so it's much more important that it's readable
and easy to understand for others (including future-you). This is
especially true if your "fastest" solution is verbose and repetitive
--  it's inconvenient if you have to modify it in the future, add
traces for debugging or step through with the debugger.

Also, whether writing something in a single line or two is faster
depends on the compiler, and might change when better optimization is
introduced in a future version. Common ways of doing something are
probably more likely to get optimized.

Stating the obvious, try to find a better algorithm first.

And finally, have a look at haXe. That touches the compiler
optimization part again -- the haXe compiler knows much about your
code than the AS3 compilers, so it can do better optimization. Part of
it is explained here:

Note inlining and haxe.rtti.Generic. For an AS3 vs haXe example, read:


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


Re: [Flashcoders] hi All

2008-07-11 Thread Mark Winterhalder
> When I have loaded one swf, can I store it - and use it at multiple places?

You may want to look into shared libraries because they might be a
better solution (using the browser cache), but if you use a loader SWF
then you can have it load another SWF with URLLoader, and store that
in a local SharedObject, to be loaded via Loader.loadBytes(). However,
the capacity of a local SharedObject is only 100KB by default, so you
would have to ask the user for permission if that's insufficient.

HTH,
Mark



On Fri, Jul 11, 2008 at 4:13 PM, Martin Klasson <[EMAIL PROTECTED]> wrote:
> Am fairly new into the AS3 features, but I guess this still isn't doable:
>
> When I have loaded one swf, can I store it - and use it at multiple places?
>
> it can be done with images that are loaded by using bitmap/bitmapdata and so
> on...
>
> but that cant be done with swfs still can it?
> I dont have a problem - I am just wondering about if it is possible,
> I tried using ByteArray to clone a loaded swf and adding it to another
> child,
> but that did not work.
>
> Just curious if it should work?
>
>
> --
>
> Martin Klasson
> Flash Developer
> Parkgatan 9-11
> S-411 24 Göteborg
> Sweden
> Office +46 (0) 31 711 54 50
> Cell +46 (0) 730 964 561
> [EMAIL PROTECTED]
> www.kokokaka.com
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>

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


Re: [Flashcoders] Getting dimensions of visible area

2008-06-28 Thread Mark Winterhalder
> I want to be able to get the width and height of the visible area in 
> ActionScript.  Is this possible?  The fact that the Player "knows" there is a 
> mask and correctly hides the outer parts indicates that it should have that 
> information somewhere.

Have you tried the width and height of the mask instead?
(The flash.display.DisplayObject.mask property.)

Mark




On Sat, Jun 28, 2008 at 11:56 AM, Arka Roy <[EMAIL PROTECTED]> wrote:
> Hi,
>
> My first post.
>
> I'm a newbie at Flash but was a game programmer (C/C++) for a long time.  I'm 
> finding Flash to be highly quirky and very interesting.
>
> I have a question about images imported from Illustrator CS3 with masks.
>
> These images have artifacts outside of their visible area.
> For example, it can have a picture of a dog's face, but one of the
> long ears is off to the side, outside the visible region of the piece.  We 
> cannot crop the piece for our own reasons, but the mask makes it such that 
> the ear sticking out is invisible in
> Flash, when we turn it into  a movie clip.  Also, the Info panel in the Flash 
> IDE correctly shows the width and height of the visible area ONLY.
>
> However, in ActionScript when I try to get the width and height using the 
> DisplayObject width and height properties it returns the dimensions of the 
> entire image including the hidden portions.
>
> You can see them here:
>
> Visible area only
> http://arkaroy.e3b.org/scraps/piece.jpg
>
>
> Entire image with visible area masked in red
> http://arkaroy.e3b.org/scraps/mask.jpg
>
>
> I want to be able to get the width and height of the visible area in 
> ActionScript.  Is this possible?  The fact that the Player "knows" there is a 
> mask and correctly hides the outer parts indicates that it should have that 
> information somewhere.
>
> By the way, all mention of dimensions I've made here pertains to bounding 
> boxes.
>
> Thanks,
> Arka Roy
>
>
>
>
> ___
> 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] switch statement more efficient than if...else?

2008-06-25 Thread Mark Winterhalder
> I'd always thought that the most efficient was the switch

I know that the haXe compiler uses a jump table, I'm not sure about
the AS3 compiler. But as already mentioned there is an extra opcode
for switch, and even if the compiler doesn't a jump table, it might
use one in the future.

So, switch at least isn't slower, even if it isn't faster yet it has
the potential to become faster in the future, and it's more readable
in any case -- making switch the preferable choice.

The question should be "is switch on int faster than switch on String?"

Mark



On Wed, Jun 25, 2008 at 4:12 PM, Allandt Bik-Elliott (Receptacle)
<[EMAIL PROTECTED]> wrote:
> Hi guys
>
> quick question that came up in a conversation I had the other day - are
> switch statements more or less efficient than a series of if...else
> statements in either AS2 or AS3?
>
> I'd always thought that the most efficient was the switch
>
> al.z
>
> ___
> 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] Why do you compile with the Flash IDE?

2008-05-16 Thread Mark Winterhalder
On Fri, May 16, 2008 at 4:43 PM, Romuald Quantin
<[EMAIL PROTECTED]> wrote:
> Just a question, what kind of projects are you doing on Linux?
>
> I can't use linux because all the designers I'm working with are working
> with the Adobe CS3 (illustrator, and so on), and I'm not able to open their
> files on linux.
>
> Is there a way now? Or do you have tips to be able to work with people using
> Adobe CS3? Or do you use 2 OS?

I used to give the designer specific instructions, i.e., the linkage
names, instance names, parent/child trees. Later I used Swfmill, yet
later I only needed relatively few graphics, all bitmap assets, almost
everything was code -- the designer gave me PNGs, I embedded them all
as one large binary in an SWF with a small ugly tool I hacked together
for that purpose, and used ByteArray.loadBytes(). Recently I switched
to Flexbuilder.

There are many ways to do it, but of course the workflow needs to be
adjusted. If the designer just gave me an Illustrater file, I'd give
him uncompiled code in return. :)

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


Re: [Flashcoders] Why do you compile with the Flash IDE?

2008-05-16 Thread Mark Winterhalder
Ah, I see...

I've heard that an XML representation of FLAs is in the works, that
will hopefully solve that issue. Frankly, I'm not happy with Flex's
inline embedding, either. Maybe that XML will become a
IDE/platform/vendor independent way of providing sources and make
everybody happy.

Mark



On Fri, May 16, 2008 at 4:38 PM, Romuald Quantin
<[EMAIL PROTECTED]> wrote:
> I'm not sure you understood me well :)
>
> Probably my fault.
>
> What's true is that strong coders are moving away from Flash, and use the
> Flex SDK + FDT or flash develop for example.
>
> But when I said put a FLA file for other developers is useful for them, the
> only code that is in the FLA is the name of the Main Class (entry point), I
> also can't stand code in the FLA... it is just a nightmare.
>
> So it has nothing to do with reusability and it is not even changing your
> way of coding. I was just saying that if you make a source without FLA
> available, if the coder behind want to update something, better for him to
> be able to do it without Flash IDE, otherwise he's just stuck.
>
> Romu
>
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mark
> Winterhalder
> Sent: 16 May 2008 15:09
> To: Flash Coders List
> Subject: Re: [Flashcoders] Why do you compile with the Flash IDE?
>
> On Fri, May 16, 2008 at 3:13 PM, Romuald Quantin
> <[EMAIL PROTECTED]> wrote:
>>  The thing is, if someone is going to use your source later, it is nice
> for
>>  them to have a FLA especially if they don't know how to use Flex, Flash
>>  Develop, FDT or whatever...
>
> I have no way of opening a FLA. I haven't used (or missed) Flash since
> I switched to Linux three years ago, and even before that, only used
> it as a compiler and to build the library. I know many are working in
> the same manner.
> I might be able to use the designer's mac to quickly fix something in
> that FLA, or to pull out code, but it's quite inconvenient and not
> everybody has that option. I'm sure that for coders, the tendency is
> to move away from Flash and use alternative workflows instead.
> So, if someone wants to keep using Flash and FLAs that's her or his
> choice, fine with me, but please don't put something into a FLA
> thinking the code can be reused more easily -- the opposite is the
> case.
>
> Mark
> ___
> 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] Why do you compile with the Flash IDE?

2008-05-16 Thread Mark Winterhalder
On Fri, May 16, 2008 at 3:13 PM, Romuald Quantin
<[EMAIL PROTECTED]> wrote:
>  The thing is, if someone is going to use your source later, it is nice for
>  them to have a FLA especially if they don't know how to use Flex, Flash
>  Develop, FDT or whatever...

I have no way of opening a FLA. I haven't used (or missed) Flash since
I switched to Linux three years ago, and even before that, only used
it as a compiler and to build the library. I know many are working in
the same manner.
I might be able to use the designer's mac to quickly fix something in
that FLA, or to pull out code, but it's quite inconvenient and not
everybody has that option. I'm sure that for coders, the tendency is
to move away from Flash and use alternative workflows instead.
So, if someone wants to keep using Flash and FLAs that's her or his
choice, fine with me, but please don't put something into a FLA
thinking the code can be reused more easily -- the opposite is the
case.

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


Re: [Flashcoders] Custom MovieClip Classes

2008-03-21 Thread Mark Winterhalder
>  Now I would the like to let RegistrationPanel inherit some behaviours from
>  APanel. But it allready extends MovieClip... How can I do this ?

You can have RegistrationPanel extend APanel.

You need to inherit from MovieClip, but you don't have to do it
directly. APanel extends MovieClip, so when RegistrationPanel extends
APanel, it will also extend MovieClip. Like a dog is a mammal, and a
mammal is an animal, so a dog is an animal, too.

Mark



On Sat, Mar 22, 2008 at 12:24 AM, Omar Fouad <[EMAIL PROTECTED]> wrote:
> List,
>
>  I have a MovieClip in my Flash Library with Class Name APanel.
>
>  The class obviously extends MovieClip;
>
>  Also I have another MovieClip in the library Called RegistrationPanel and
>  It's class also would extend the MovieClip's one.
>
>  Now I would the like to let RegistrationPanel inherit some behaviours from
>  APanel. But it allready extends MovieClip... How can I do this ?
>
>  --
>  Omar M. Fouad - Digital Emotions
>  http://www.omarfouad.net
>
>  This e-mail and any attachment is for authorised use by the intended
>  recipient(s) only. It may contain proprietary material, confidential
>  information and/or be subject to legal privilege. It should not be copied,
>  disclosed to, retained or used by, any other party. If you are not an
>  intended recipient then please promptly delete this e-mail and any
>  attachment and all copies and inform the sender. Thank you.
>  ___
>  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] Lightweight Collision for Platform Game

2008-03-04 Thread Mark Winterhalder
On Tue, Mar 4, 2008 at 11:34 PM, Elia Morling <[EMAIL PROTECTED]> wrote:
> What is the best collision system for a platform game? I've currently looked
>  at box2D, but I think it runs amazingly slow on afew macs and other
>  machines. Therefore I wonder if there is anything faster lightweight? I
>  think I may need move towards a ray placed under the character instead of
>  actually box-to-box collision. Any ideas?

The Flashplayer's native hitTest() is a fast bounding box test for two
specific clips, or pixel-exact test for a point and a clip. But if you
have several objects you need to test against each other, then
minimizing the total number of tests should come first. A quad tree
helps with that:



That should give you a small number of potential hits, which you can
then test with a more exact (and expensive) operation.

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


Re: [Flashcoders] Recommendations to access cache

2008-01-21 Thread Mark Winterhalder
> When loading elements to the cache.. how can we ensure that when we try to
> access the same element later during the life of an application that the
> same element will be accessed from cache rather than re-loading the same
> file?

You can't. You can keep it in memory as long as the movie plays, but
you can't rely on the browser cache. The user might even have turned
cache off.
An alternative could be using a local SharedObject. It's not 100%
reliable, either, but at least you know when it fails.

Mark


On Jan 22, 2008 12:04 AM, Helmut Granda <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> When loading elements to the cache.. how can we ensure that when we try to
> access the same element later during the life of an application that the
> same element will be accessed from cache rather than re-loading the same
> file?
>
> For example I want to load 300 graphics to cache while the first section of
> my movie is playing (rather than preaload them all and make the user wait
> long). When I try to access the same element from within the movie, will
> those elements be accessed from cache or will the be re-loaded?
>
> --
> ...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


Re: [Flashcoders] Question about Arrays

2008-01-11 Thread Mark Winterhalder
On Jan 11, 2008 11:34 PM, Mark Lapasa <[EMAIL PROTECTED]> wrote:
> I too would expect that it would need to be casted.

Yes, one would think so.

I can't answer your question, either, but can't help but note that in
haXe you would declare your array as Array. The compiler
wouldn't let you put anything else into it, and likewise, everything
you'd pull out would be of type MyClass. haXe has a great type system
(including implied types and type templates), so if you're the kind of
coder that wonders about issues like that, I recommend you have a llok
at .

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


Re: [Flashcoders] unsetting object property in AS2

2007-10-20 Thread Mark Winterhalder
Andrew,

you can do 'delete myObject.myProperty', and you may want to look into
linked lists as an alternative to arrays:


HTH,
Mark



On 10/19/07, Andrew Sinning <[EMAIL PROTECTED]> wrote:
> A question in my sent box from when the list went down:
>
> I like to use the Object class as an index, but there doesn't appear to
> be a way to completely remove a property from an object.  I can set the
> value to null, but I'd really like to be able to remove the property
> completely.  Why? Because if I want to do a reverse lookup, then I have
> to iterate through all of the properties, but having to iterate through
> the nulled values seems inefficient.
>
> I can do this with another class, something that includes an Array to
> keep track of current properties and an Object for the index, but I'm
> wondering if I'm overlooking something.  Often I find that I am.
>
> Speaking of Arrays, it's a bit frustrating that there's no easy way to
> remove an item from an array either.  Currently I use:
>
>iterate through the array to find the index of the needle
>splice the Array at the index
>
> Is there a faster way to remove an item from an array?
>
>
> Thanks!
> ___
> 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] Command-line compiler to change library contents

2007-09-17 Thread Mark Winterhalder
Sam,

have a look:


HTH,
Mark


On 9/17/07, Sam Edwards <[EMAIL PROTECTED]> wrote:
> Hello All!
>
> I need to be able to deploy an entirely self-contained .swf (no
> network access, no local access... i don't know why not, I've just
> been told that's the way it is) BUT I need to be able to run a script
> that will swap out images that exist as library symbols, very
> Generator-like (those were the days kinda)
>
> I need to target Flash 8 so the Flex command-line compiler isn't an
> option. I've built a similar system before where ColdFusion generated
> the Flex MXML and called a .bat to run the compiler (not exactly
> standard practice but it worked brilliantly), and now I need to
> basically replace the Flex compiler with something else that targets
> Flash 8 and allows me to say library symbol X contains
> "suchandsuch.jpg". Also, I'm moderately desperate. Has anyone done
> this sort of thing before? OpenLaszlo maybe?
>
> Thank you for reading and for any suggestions you have!
> sam
> ___
> 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] Compound interest formula

2007-09-16 Thread Mark Winterhalder
Hello Kerry,

On 9/15/07, Kerry Thompson <[EMAIL PROTECTED]> wrote:
> I'm ok with math, but it's not my strong suite.
>
> Does somebody have the compound interest formula, preferably in AS2 form?
>
> It comes in various forms. The one I need is, given an interest rate, a
> period of time, and an end goal, what monthly payments do you need to make.
>
> In other words, assuming 8% annual return, and you want $1,000,000 in 25
> years, how much do you need to set aside each month?

Isn't this the same as amortization of debt?



But please don't rely on me with this. Double check with existing
examples, and be careful about how interest is payed (monthly? yearly?
quarterly?).

All I'm saying is, the formula /should/ be (roughly) identical. Best
give it a shot, fill in your own numbers, and then ask your bank and
see if they come up with the same result. It might be a month off, or
a month's worth of interest, or I might be completely wrong...

Mark
___
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] Compound interest formula

2007-09-16 Thread Mark Winterhalder
Sorry, on second thought, it's quite different.
With amortization, you have a longer period with a larger amount, with
saving, a longer period with a smaller amount. So the compound
interest changes the picture entirely. But maybe the derivation of the
formula is of some help.

Mark


On 9/15/07, Mark Winterhalder <[EMAIL PROTECTED]> wrote:
> Hello Kerry,
>
> On 9/15/07, Kerry Thompson <[EMAIL PROTECTED]> wrote:
> > I'm ok with math, but it's not my strong suite.
> >
> > Does somebody have the compound interest formula, preferably in AS2 form?
> >
> > It comes in various forms. The one I need is, given an interest rate, a
> > period of time, and an end goal, what monthly payments do you need to make.
> >
> > In other words, assuming 8% annual return, and you want $1,000,000 in 25
> > years, how much do you need to set aside each month?
>
> Isn't this the same as amortization of debt?
>
> <http://en.wikipedia.org/wiki/Amortization_calculator>
>
> But please don't rely on me with this. Double check with existing
> examples, and be careful about how interest is payed (monthly? yearly?
> quarterly?).
>
> All I'm saying is, the formula /should/ be (roughly) identical. Best
> give it a shot, fill in your own numbers, and then ask your bank and
> see if they come up with the same result. It might be a month off, or
> a month's worth of interest, or I might be completely wrong...
>
> Mark
>
___
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] Reliable way to split a string into an array of lines?

2007-09-13 Thread Mark Winterhalder
var lines : Array = (str.indexOf( "\r\n" ) > -1) ? str.split( "\r\n" )
: str.split( "\n" );

Or, if you want to take MacOS 9 into account:

var lines : Array;
if( str.indexOf( "\r\n" ) > -1 ) {
   lines = str.indexOf( "\r\n" );
} else if( str.indexOf( "\n" ) > -1 ) {
   lines = str.split( "\n" );
} else if( str.indexOf( "\r" ) > -1 ) {
   lines = str.split( "\r" );
} else {
   lines = str;
}

(You don't actually need the "default", splitting on a non-existing
string should return an array of length 1. It's just more clear that
way.)

HTH,
Mark


On 9/12/07, Danny Kodicek <[EMAIL PROTECTED]> wrote:
> I'm looking for a simple, reliable method for splitting a string into its
> constituent lines (at the hard line breaks - this isn't a text wrapping
> thing). The problem is that line breaks could be Chr(10) or Chr(13), or
> indeed both. I've done this:
> myArr =
> myStr.split(String.fromCharCode(10)).join(String.fromCharCode(13)).split(Str
> ing.fromCharCode(13))
>
> I'm guessing I'm better off going the RegEx route, but I was wondering if
> there's a quicker, simpler way.
>
> Danny
>
> ___
> 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] toString(aArray[i]) ?? does this work

2007-09-12 Thread Mark Winterhalder
var  myStr:String  =  aArray[i].toString();

HTH,
Mark


On 9/11/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Quick question, can I toString an array element.
> ie:   var  myStr:String  =  toString(aArray[i]);// where 'i' is the 
> increment.
>
> I am having an issue with this.  when I trace myStr it traces [object object]
> instead of what I intended/expected "mcMovieClipName14" as a string.
>
> Any insite would be appreciated.
>
> Thanks in advance,
>
> Paul V.
> ___
> 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] Golden Ratio Spiral points

2007-09-10 Thread Mark Winterhalder
> var radius = Math.pow( a * c, angle );

Ooops, should be:
var radius = a * Math.pow( c, angle );

And angle is in radians, so Math.PI * 2 is a full circle. It's what
Math.atan2() gives you (not so incidentally), so if you want to tie it
to a mouse pos...

Mark


On 9/11/07, Mark Winterhalder <[EMAIL PROTECTED]> wrote:
> Hi Jason,
>
> to translate the Wikipedia page:
>
> var c = Math.pow( (1 + Math.sqrt( 5 )) / 2, 2 / Math.PI );
> var a = aPositiveRealNumber; // like, 1
>
> // in your loop:
> var radius = Math.pow( a * c, angle );
> var x = Math.cos( angle ) * radius;
> var y = -Math.sin( angle ) * radius;
>
> You keep incrementing angle, obviously.
> If the spiral seems to go into the wrong direction, remove the minus
> in the y line. Adjust 'a' to in-/decrease growth.
>
> HTH,
> Mark
>
>
>
> On 9/10/07, Merrill, Jason <[EMAIL PROTECTED]> wrote:
> > \I'm no math whiz, does anyone know how I can draw a golden spiral and 
> > position and move sprites/movieClips along a golden spiral path?
> >
> > What is a golden spiral?
> > http://en.wikipedia.org/wiki/Golden_spiral
> > "In geometry, a golden spiral is a logarithmic spiral whose growth factor b 
> > is related to φ, the golden ratio. Specifically, a golden spiral gets wider 
> > (or further from its origin) by a factor of φ for every quarter-turn it 
> > makes."
> >
> > Or a spiral shape in general?  I want to position a point along the spiral 
> > based on numerical data.  Then as things change, animate the object along 
> > the path of the spiral.  I need this to be dynamic, not hand-drawn guide 
> > layers.  Anyone know how to translate this math to Actionscript?
> >
> > Thanks,
> >
> >
> > Jason Merrill
> > Bank of America
> > GT&O Learning & Leadership Development
> > eTools & Multimedia Team
> >
> >
> >
> > ___
> > 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] Golden Ratio Spiral points

2007-09-10 Thread Mark Winterhalder
Hi Jason,

to translate the Wikipedia page:

var c = Math.pow( (1 + Math.sqrt( 5 )) / 2, 2 / Math.PI );
var a = aPositiveRealNumber; // like, 1

// in your loop:
var radius = Math.pow( a * c, angle );
var x = Math.cos( angle ) * radius;
var y = -Math.sin( angle ) * radius;

You keep incrementing angle, obviously.
If the spiral seems to go into the wrong direction, remove the minus
in the y line. Adjust 'a' to in-/decrease growth.

HTH,
Mark



On 9/10/07, Merrill, Jason <[EMAIL PROTECTED]> wrote:
> \I'm no math whiz, does anyone know how I can draw a golden spiral and 
> position and move sprites/movieClips along a golden spiral path?
>
> What is a golden spiral?
> http://en.wikipedia.org/wiki/Golden_spiral
> "In geometry, a golden spiral is a logarithmic spiral whose growth factor b 
> is related to φ, the golden ratio. Specifically, a golden spiral gets wider 
> (or further from its origin) by a factor of φ for every quarter-turn it 
> makes."
>
> Or a spiral shape in general?  I want to position a point along the spiral 
> based on numerical data.  Then as things change, animate the object along the 
> path of the spiral.  I need this to be dynamic, not hand-drawn guide layers.  
> Anyone know how to translate this math to Actionscript?
>
> Thanks,
>
>
> Jason Merrill
> Bank of America
> GT&O Learning & Leadership Development
> eTools & Multimedia Team
>
>
>
> ___
> 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] Calculate how many days until date

2007-09-05 Thread Mark Winterhalder
On 9/5/07, Paul Steven <[EMAIL PROTECTED]> wrote:
> Thanks Mark - that is fantastically helpful!!

You're welcome -- but I made a mistake, and it should be Math.ceil()
instead of Math.floor(). You probably noticed that anyway.

Mark
___
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] Calculate how many days until date

2007-09-04 Thread Mark Winterhalder
On 9/5/07, Mark Winterhalder <[EMAIL PROTECTED]> wrote:
> trace( "You have to wake up only " + Math.floor( ((new Date( 2007, 12,
> 25 )).getTime() - (new Date()).getTime()) / (24 * 3600 * 1000) ) + "
> times until it's Christmas!" );

Actually, you don't even need the getTime() -- valueOf() does the same
thing, and you can also use Date.UTC().



HTH,
Mark
___
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] Calculate how many days until date

2007-09-04 Thread Mark Winterhalder
On 9/4/07, Paul Steven <[EMAIL PROTECTED]> wrote:
> I need to calculate how many days there are until a specified date in the
> future.
>
> Is there any built in functionality to do this, or if not, can anyone point
> me in the right direction. I would imagine it is difficult to do manually as
> it would need to take account of leap years etc.

trace( "You have to wake up only " + Math.floor( ((new Date( 2007, 12,
25 )).getTime() - (new Date()).getTime()) / (24 * 3600 * 1000) ) + "
times until it's Christmas!" );

HTH,
Mark
___
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] Intro to OOP using ActionScript

2007-08-21 Thread Mark Winterhalder
On 8/21/07, David Ngo <[EMAIL PROTECTED]> wrote:
> What kind of argument is that? I've never learned to ski and I was able to
> pick up snowboarding. One is not dependant upon the other.

Sigh... I guess I should know better than attempting irony in an email.

Of course you can learn how to snowboard without first learning how to
ski. It's even easier. To claim otherwise would be silly.

I think with OOP it's the same thing.

Mark
___
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] Intro to OOP using ActionScript

2007-08-21 Thread Mark Winterhalder
> If you take somebody snowboarding and force them to learn how to do a
> 720 without teaching them anything else, they will eventually be able to
> do a 720.  If you instead teach them all the basic moves, how to enter
> and exit tricks, and then move into 180s, 270s and 360s, they'll be much
> better at snowboarding in general and will naturally learn 720s soon after.

You can't just teach somebody to snowboard without first teaching them
how to ski.
They need to get a feeling for the snow first, on two boards, learn
how to use the lift and so on.

But in terms of programming, I agree with Ron. OOP is more natural and
closer to real life experiences.

Mark


On 8/21/07, Steven Sacks <[EMAIL PROTECTED]> wrote:
> Procedural isn't wrong.  OOP isn't right.  They're used for different
> purposes.  The fact is, OOP is a trade off for flexibility and
> scalability over speed; speed in development, speed in execution.
> Procedural programming has its place (ask any game developer).
>
> Procedural programming is a necessary and important first step in
> learning how to code.  It's the best way to learn how programming works
> because it's a simplified approach and won't get in the way of learning
> basic syntax.
>
> People with no programming experience will not understand abstract
> concepts like classes, inheritance, polymorphism, and encapsulation -
> the very things that make up OOP.
>
> OOP is a specialized dialect, built upon the basic language of
> programming.  If you don't learn the basics, you can't truly learn the
> dialect.  It's akin to learning phrases from a French phrase book and
> going to Paris on vacation versus learning how conjugation and verb
> tenses work combined with vocabulary.  Who is going to be more
> successful at carrying on rudimentary conversations, or understanding
> what's being said to them?
>
> If we take two students and you teach them OOP for 1 month and I teach
> them procedural for two weeks and then OOP for two weeks, my student
> will be further along than your student. The reason is simple.  When you
> learn the fundamentals first you have a greater capacity for
> understanding of more advanced topics.
>
> If you take somebody snowboarding and force them to learn how to do a
> 720 without teaching them anything else, they will eventually be able to
> do a 720.  If you instead teach them all the basic moves, how to enter
> and exit tricks, and then move into 180s, 270s and 360s, they'll be much
> better at snowboarding in general and will naturally learn 720s soon after.
>
> Plus, if you sit down with non-programmers to teach them OOP, and you
> have to teach them the basics first, you will find yourself naturally
> teaching them procedural programming because every time you try to move
> into topics OOP, your students will get lost and you'll end up circling
> back to explain the basics again.
>
> OOP is not a beginner topic.
>
> ___
> 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] [Script_in_Action] New Links

2007-08-20 Thread Mark Winterhalder
On 8/20/07, Dave Watts <[EMAIL PROTECTED]> wrote:
> Just as a heads-up, when you BCC Flashcoders your messages will not be sent
> to the list automatically.

Also, my filter won't catch it and it ends up in my inbox instead of
in FlashCoders.

Mark
___
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] accessing super fields

2007-08-20 Thread Mark Winterhalder
On 8/20/07, Hans Wichman <[EMAIL PROTECTED]> wrote:
> Hi Mark,
>
> why is it static?

Uhm... because I didn't read properly, sorry. :/

> Its declared as private var not as private static var?

I could swear it read 'static var' when I first read the mail. Now you
made Gmail change it some how. :)

Anyway, interesting question. I think Kerry's explanation is
conceptually right, and even technically correct for AS3 as far as I
understand the inner workings so far.
But in AS2, when you do

class SuperClass {
 private var _test:String = null;
}

technically you set SuperClass.prototype._test = null. So to do what
you want to do, you can access it as this.prototype.prototype._test
from within your child class instance.

HTH,
Mark
___
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] accessing super fields

2007-08-20 Thread Mark Winterhalder
Hi Hans,

'super' refers to the instance, but your static _test isn't part of
the instance, it is part of the class (technically, of the constructor
function). Imagine it as this.prototype.prototype, although it
technically isn't the same (well, maybe it is, I haven't tested it).
It behaves like super would, with the exception of the super() call of
the constructor.
To do what you want, super.constructor._test would probably work (but
again, I haven't tested it).

HTH,
Mark


On 8/20/07, Hans Wichman <[EMAIL PROTECTED]> wrote:
> Hi,
>
> lets say i have a superclass:
>
> class SuperClass {
>  private var _test:String = null;
> }
>
> and a subclass:
>
> class SubClass {
> private function _testFunction () {
>   super._test = "foo";
> trace (super._test);
> }
> }
>
>
> this traces undefined.
>
> If I remove the super. it works, but I like to know when I'm referencing
> super class fields.
>
> It is fixed as well, when I nicely wrap the setting of _test in a function,
> as I should, but I'm still wondering why it fails.
>
> Any ideas?
>
> greetz
> JC
> ___
> 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] Intro to OOP using ActionScript

2007-08-20 Thread Mark Winterhalder
On 8/20/07, Steven Sacks <[EMAIL PROTECTED]> wrote:
> If these students have no experience programming, you just can't start
> with OOP.

Sure you can. Just look at what Alan Kay did with kids and Squeak
(essentially Smalltalk). Here's a good talk by him, btw, much about
learning and computer/interface history:


(Get the Mpeg2, it contains very old footage filmed off a screen)

> I disagree with the statement that AS2 is on the way out.

That it'll take it some time to make it through the door doesn't mean
it's not on the way out.
Yes, some folks will use it for a long time to come, because of legacy
code bases, admins refusing to allow FP9 on their systems, and
unwillingness to learn. But those kids don't have a code base yet,
they don't have corporate clients and they have to learn anyway.

> If you were teaching Java or Ruby, I would say go OOP right away.

Because Java and Ruby don't have arrays? :)

> But
> Flash is only now becoming OOP strong and AS3, while a good step in the
> right direction, is not the absolute best OOP language to teach because
> of all the other things that make up Flash development that have less to
> do with Actionscript and more to do with Flash itself.  Ruby is a
> fantastic OOP language, though it might be a bit heady for newbies.

He's not teaching them Flash development, he'll be teaching them
(OOP-) Programming and using ActionScript as an example. There's a
difference.
But you have a point, at least as long as we're talking about AS2. We
still have a question open, and it explains why AS3 would have been
more appropriate:

"On a serious note, how do you get an "enter_frame" event handler to
work inside an AS file?"

If by AS file you mean a class instance where you would like to call a
method called 'handleEnterFrame', here's how you'd do it with AS3
(from within the class, say, in the constructor):

anyDisplayObject.addEventListener( Event.ENTER_FRAME, handleEnterFrame );

In AS2, it's a bit more complicated. If the class inherits from
MovieClip and assigned to a clip in the library, then you can just
give it a method called 'onEnterFrame'. Otherwise you have to deal
with the scope, which caused problems for so many that they introduced
Delegate to help you with it:

anyMovieClip.onEnterFrame = Delegate.create( this. handleEnterFrame );

For AS2, keep in mind that you can have only one onEnterFrame per
MovieClip, so if you have multiple instance that need the event, you
have to have one MovieClip for each. Or write a class that relays the
event to multiple listeners, essentially mimicking the behaviour AS3
would give you out of the box. (Btw, it may be a good idea to provide
such a class to the students)

Finally, the Bruce Eckel book Johannes mentioned is available online:


Regarding patterns, I would mention them but not put much emphasis on
the subject, at least not if it's a beginner course.

Anyway, I think Flash is a good choice. Mainly because you get to see
results so quickly. It's very easy to make something appear and move
it around, so you have a feeling of accomplishment very early.

Mark


On 8/20/07, Steven Sacks <[EMAIL PROTECTED]> wrote:
> If these students have no experience programming, you just can't start
> with OOP.  They have no foundation to understand the concepts.  You have
> to walk before you can run, and OOP is definitely runners territory.
> Students with no programming experience are barely crawling.  Arrays,
> Strings, Objects, Functions, Variables - these things are your first
> steps.  You can't learn those while learning about Classes, Inheritance,
>   and Design Patterns.  Those things are based on solid foundations.
>
> Anyone here who says they would have been better off if they learned OOP
> from the get-go is dismissing everything it took to get where they are.
>   Procedural code has its purpose sometimes and knowing how and when to
> use it is important, especially in Flash.
>
> I disagree with the statement that AS2 is on the way out.  Jesse Warden
> blogged about that very subject which mirrored my own feelings on the
> subject.  AS2 will be around for some time to come.  The fact is, AS3 is
> such a leap from AS2 most Flash developers will not be able to (or want
> to) make the leap.  Only senior level coders will, and certain bright
> designer/coder types.  Eventually, people might, but agencies will be
> able to turn out great Flash sites with AS2 (even AS1) for years to come.
>
> The fact is, you can still do a lot in Flash by hacking AS1 procedural
> code, and this skill is an absolute requirement in agency work where
> you're working with short timelines, ridiculous client changes
> throughout the process, and the site is a churn and burn never to be
> touched again after it goes live.  AS2/AS1 is going to remain king in
> that very large sect of Flash development for some time to come.
>
> I

Re: [Flashcoders] Intro to OOP using ActionScript

2007-08-19 Thread Mark Winterhalder
On 8/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> But if you want to try blogs, then here's a couple of reliable ones:
>
> Grant Skinner - http://www.gskinner.com/blog/
> Colin Moock   - http://www.moock.org/
> Keith Peters  - http://www.bit-101.com/blog/
> Aral Balkan   - http://aralbalkan.com/
> Guy Watson- http://www.flashguru.co.uk/
> Richard Leggett   - http://www.richardleggett.co.uk/blog/index.php

Yeah, right -- that's what his post was about in the first place. :)

Adding to the list, I came across this the other day -- well
explained, plus some really pretty interactive examples:


Mark
___
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] Intro to OOP using ActionScript

2007-08-19 Thread Mark Winterhalder
> I'm a high school teacher who's decided to teach "Intro to
> Programming" using Actionscript (2.0 for now, waiting for the school
> to upgrade).

You don't have to limit yourself to AS2 just because your school's
Flash version isn't CS3 yet.
If you plan to go the OOP route, and Pong specifically, there probably
won't be that much in terms of timeline animation anyway. You'll have
graphics for the paddles, the ball and the score. That'll pretty much
be it, the rest will be code. You don't need the Flash IDE for that.
I'd recommend you have a look at the Flex 2 SDK (or even haXe[.org]).

There are several reasons why I believe that it is an alternative you
should consider:
AS2 is on the way out, AS3 will stay. AS3's API is more consistent.
AS3 is compiled for the new (much faster) VM, which is a big advantage
for games. Finally, and this is the most important reason IMHO, the
Flex 2 SDK is free, so your students can (legally) install it at home.

Mark




On 8/20/07, Mike Reilly <[EMAIL PROTECTED]> wrote:
> Hi there -
>
> I'm a high school teacher who's decided to teach "Intro to
> Programming" using Actionscript (2.0 for now, waiting for the school
> to upgrade).
>
> I'd prefer to take an OO approach, and use games in doing so.  For
> example, my first game would be a Pong copy.  Lots of basics in there
> to learn the environment, basic principles, etc.
>
> So, I was wondering if anyone out there knew of good resources, wanted
> to contribute (hell, I'll give you all the credit, you can write a
> book, etc.), collaborate, share.  I've search most of the tutorial
> sites, but most code is not a great OO example for Flash games due to
> little OO, or too much complexity for the beginner.
>
> Your input is welcome, rock on.
>
> Mike
> ___
> 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 copy with random order

2007-08-13 Thread Mark Winterhalder
My archive doesn't go back to the original thread, but I found a
reference to it:

Array.prototype.shuffle = function() {
   var i = this.length;
   while (i) {
   var p = random(i);
   var t = this[--i];
   this[i] = this[p];
   this[p] = t;
   }
}

That's the solution Fumio Nonaka and Tatsuo Kato came up with back in
the day. It was a classic, extensive discussion on the topic here,
from a very long time ago. I still remember following it, as a young
coder, watching how some of the greatest FlashCoders of the time
discussed what the fastest way of shuffling an array might be.

Ah, well. Those were the days...

Mark
___
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] Can I load AS2 swfs into an AS3 swf?

2007-08-08 Thread Mark Winterhalder
On 8/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hiya, the title sums up my question pretty well. I have a bunch of old swfs 
> that are published to version 6 and are AS2. I want to load these into a 
> movie published to v9 and in AS3 or maybe a flex app. Is this possible or do 
> I have to converrt alll of my code?



HTH,
Mark
___
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] garbage collection and asychronous execution

2007-08-06 Thread Mark Winterhalder
On 8/6/07, Mark Hawley <[EMAIL PROTECTED]> wrote:
> That isn't a reference to a function -- it's a reference to a object method.
> The object has to hang around.

No, it's a reference to a function. The VM doesn't know anything about methods.
The interval keeps a reference to the function, the object gets
garbage collected, then the function gets called. It doesn't need an
object. In fact, if you'd add a trace( this ), it would be undefined.

Mark
___
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] Q: loop speed AS2 and AS3

2007-07-27 Thread Mark Winterhalder
> is only noticeable when you're doing 50,000+ loops of non-trivial code.

When you're doing 50,000+ loops of non-trivial code, I don't think
it's performance of the loop you have to worry about. :)

Here's something about performance:

(Note the comments)

With the haXe version posted by BlackDog on the haXe list, I'm getting:
Flash 8: 12min 33s (only ten repetitions, extrapolated to 100)
Flash 9: 15s
Neko: 17.5s
(Java version from the blog post: 3s)

That's just /one/ benchmark, but it should give you an idea about how
much faster the new VM is compared to the old one.

Mark


On 7/27/07, Steven Sacks <[EMAIL PROTECTED]> wrote:
> FLASM:  http://flasm.sourceforge.net/#optimization
>
> When it comes to optimizing, there are a few key things to remember:
>
> 1) Subtraction is faster than addition
> 2) Decrementation is faster than incremenations
> 3) Pre-decrementation is faster than post-decrementation
>
> By faster, it means there is less bytecode to run.
>
> The fastest loops in AS1 and AS2 are:
>
> var i:Number = len;
> while (--i -(-1))
> {
>// faster
> }
>
> and
>
> do
> {
>// fastest (in theory)
> } while (--i -(-1))
>
>
> However, the difference between those and
>
> var i:Number = len;
> while (i--)
> {
>// stuff
> }
>
> is only noticeable when you're doing 50,000+ loops of non-trivial code.
>
> Keep in mind do...while runs at least once.
>
>
> ___
> 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] Rotating, skewing and coloring TextFields using device fonts.

2007-07-24 Thread Mark Winterhalder

On 7/24/07, David Rorex <[EMAIL PROTECTED]> wrote:

Personally I think you should keep it as compatible as possible. Otherwise,
someone might develop a SWF, only checking against gnash, and not realize
that it doesn't work correctly in the official player (which the majority of
users will be using). This means that gnash would not be as useful for
developing, since you'd need to doublecheck against the official player all
the time. My opinion is that extra functionality or changed functionality is
much worse than missing functionality.


I agree that it should be as compatible as possible, but in this case,
I don't think that would be a problem. Where Gnash features overlap
with the Adobe player, they should behave exactly the same. But in
this case, I know the Adobe player can't rotate device fonts, so I
don't do that. If it would support it in a future version, it can be
expected that it would do it like with embedded fonts (i.e., like
Gnash), no there wouldn't be a problem, either.

Yes, somebody might test only on Gnash and not be aware of this. But I
believe those who develop for the mainstream /will/ check with the
Adobe player, most likely even testing /only/ on the Adobe player.
Those who test only with Gnash are much more likely to use it, say,
for an interface of a device or an app where Gnash will be used for
the menu. So why not give them that feature?

Another example where the situation would be the same would be video
codecs. Should Gnash be able to play all videos I have codecs for, or
just those the Adobe player can play? I'd hope that it could play all.

Ideally, of course, there would be a compatibility mode, of course,
and in the browser it should be the default setting.

Mark
___
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: obfuscation swf !

2007-07-19 Thread Mark Winterhalder

On 7/19/07, Jon Bradley <[EMAIL PROTECTED]> wrote:

On Jul 19, 2007, at 8:29 AM, Mark Winterhalder wrote:

> But I wonder, did anybody compare haXe vs AS3 bytecode yet? A
> decompiler is likely to assume AS3 has been used, and maybe haXe
> creates sufficiently different bytecode to confuse it.

That doesn't really matter.  If it's FP9, it's AS3. The bytecode has
to be AVM2 bytecode no matter where it comes from.


I'm not so sure about that. The generated bytecode patterns for things
like loops might be different. Stuff like that. There are many ways
how to use opcodes in sequence to achieve a certain result. IIRC, it
confused decompilers when you did manual optimizations with flasm for
the old VM.


The general point is - intrinsic methods in the Player are hardcoded
and available. References or calls to those methods can be followed,
no matter if they're named funky or not.


Exactly. That's why, if somebody would add encryption to the main SWF,
'loadBytes' would be the string I'd search for...


Let's say you call "blahblah.mask = something" and that gets
obfuscated to _3457._3 = _537.  Any sufficiently designed decompiler
will be able to mark that as _3457.mask = _537. Following those
references, a decompiler could then figure out the raw type of _537
and _3457 and mark those as maybe "spriteInstance1" or
"shapeInstance45" or whatever.

Then, the decompiler results in spriteInstance1.mask =
shapeInstance45. Legible enough to work with. I don't believe that
scenario can be avoided, no matter what compiler/obfuscator you use.


Yeah, I totally agree. It's just about making it non-trivial.

Mark
___
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: obfuscation swf !

2007-07-19 Thread Mark Winterhalder

Though, one could just use Haxe instead...


Yeah, I prefer it anyway.
But I wonder, did anybody compare haXe vs AS3 bytecode yet? A
decompiler is likely to assume AS3 has been used, and maybe haXe
creates sufficiently different bytecode to confuse it.

Mark



On 7/19/07, Jon Bradley <[EMAIL PROTECTED]> wrote:

It's basically a macro process for compiling AS classes.

One of the side effects is that it can be to obfuscate SWF files by
using your own re-write rules. Hit up the second page of the thread
to see a bit more information.

Macros are pretty cool stuff. Though the author of the toolset isn't
quite accurate in the decompiling aspect of things - basically saying
you can munge the intrinsic classes, which isn't possible. Those
classes still make calls to Player internals and can be followed
backward through the classes to 'fix' any obfuscation. So, maybe half
your code in the end will be pretty funked up. That's still probably
more than enough to make use of the decompiled code.

Bit tricky to setup and use, but it's pretty powerful if you need to
do conditional compiling and get some serious speed boosts (similar
to flasm hacking). Though, one could just use Haxe instead...

cheers,

jon


On Jul 18, 2007, at 7:32 PM, Latcho wrote:

> whats this?
>
> Jon Bradley wrote:
>> Or, if you're a masochist:
>>
>> http://www.kirupa.com/forum/showthread.php?t=256400
___
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: obfuscation swf !

2007-07-18 Thread Mark Winterhalder

On 7/18/07, Douglas Pearson <[EMAIL PROTECTED]> wrote:

Since we're talking about obfuscation/encryption does anyone know of a tool
that works for AS3 yet?

All the standard tools seem to stop with Flash 8/AS2.


I don't think there are any decompilers for AS3 yet, but I could be
wrong, and it's just a matter of time anyway.
If you want to take a shot at adding some obfuscation yourself, you
could get Swfmill off svn and hack something together that jumps
around in the ABC tags a bit. Ralf just added AVM2 opcode support the
other day.

Mark
___
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: obfuscation swf !

2007-07-18 Thread Mark Winterhalder

On 7/18/07, Jim Berkey <[EMAIL PROTECTED]> wrote:

Wonderful folks, don't worry about my feelings because my methods were so
quickly destroyed. I'm a big boy, and have enjoyed the search for the holy
swf-grail for some time now. Thanks to Rákos, I believe I am one brick away
from that wall that is higher than anyone wants to climb, and may return
today with a challenge for Rákos and others.


Cool -- I like challenges like that. While I'm convinced that total
protection is impossible, I do believe that there /might/ be a way to
make it too difficult to be worthwhile.


As to why I just don't post my methods for examination by all, I found early
on that so many people can tear down a wall and condemn it easily when they
see the skeleton, without ever trying to climb the wall, and that is not a
good judge of the effectiveness of the wall. But if you do not see the
skeleton, it is much harder to climb that wall. All of a sudden instead of
multitudes saying how silly, only a few can actually climb the wall . . .
maybe one day only one or two will be able to climb the wall. Yesterday
Rákos captured the swf, and then others decompiled and re-compiled it. I
have slept on the method that I believe Rákos used to capture the swf, and
may have an answer for it later today.




Just to give you a heads up, here's how I did it, presumably Attila
used similar techniques:
I captured the SWF with Wireshark, then sent it through swfmill
swf2xml, changed the domain name, and it worked. I'm not going to tell
you what I would have done next, though. :)


Thanks for all input, none of it was taken in a bad way,
jimbo


Thanks for the challenge,
Mark
___
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: Re[2]: [Flashcoders] obfuscation swf !

2007-07-17 Thread Mark Winterhalder

On 7/17/07, Jon Bradley <[EMAIL PROTECTED]> wrote:

You can't do it Jim - there aren't any holes to plug.

It's just technically impossible.


Agreed, it is impossible to defend an attack by somebody determined
and competent. But that doesn't mean it can't be made very difficult,
especially with the new VM. You could push it to the point where it
would take so much effort that it's just not worth it for the usual
cheater or guy who steals random Flash games.

Mark
___
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] obfuscation swf !

2007-07-17 Thread Mark Winterhalder

On 7/17/07, Jim Berkey <[EMAIL PROTECTED]> wrote:

So you are telling me that the game content is ad.swf? I don't think so . .




7 minutes. Sorry.

Mark
___
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] how to call method in sub-class instace?

2007-06-29 Thread Mark Winterhalder

On 6/29/07, Andrew Sinning <[EMAIL PROTECTED]> wrote:

How do you get a super-class instance to call an over-riding method in a
sub-class?  I'm using AS2.


Hackish, but you could do SubClass.prototype.myMethod.call( this,
arg1, arg2...);

Anyway, you don't need this, because I think what you're trying to
achieve is happening automatically already.

Say you have Foo extends Bar. Bar has the 'load' method. Both have a
'parse' method, where Bar's does some general stuff and Foo's some
special, additional stuff:

class Bar {
  ...
  public function load () : Void {
 ...
  }
  public function parse ( data : XML ) : Void {
 ...
  }
}

class Foo extends Bar {
  ...
  public function parse ( data : XML ) : Void {
 super.parse( data );
 ...
  }
}

So, you do 'var foo = new Foo()', and then 'foo.load()', I think this
is what you mean by "The call to start loading the data begins in the
super-class". You wrote it in the super class, but note that it's all
happening in the scope of 'foo', an instance of Foo. There isn't
really a difference between what is in the super class and what is in
the main class -- as long as it's not overridden, it's as if the sub
class would have the exact same code (with the exception of static
properties).
When 'parse' is called on 'foo', it will be Foo's 'parse', no matter
if the piece of code is written in your Foo, Bar, or any other
ancestor class. This is all being done automatically, there is nothing
you have to do for that to happen.

However, calling the super class' method even though it's overridden
is something you have to do explicitly. This is done by prefixing
'super', like in the example above, in Foo's 'parse' method.

There are a few on the FlashNewbies list who are also just getting
into OOP with AS2. You might want to join that list, also on
ChattyFig. They'll be running into the same problems, and questions
get answered in more detail there.

HTH,
Mark





I'm parsing data into an object.  The parser method is generalized, so
it should be in the super-class, I think...  But there are exceptions in
the sub-classes.  The call to start loading the data begins in the
super-class, but some of the sub-classes might have there own
over-riding parser methods.  Furthermore, any input values not caught by
the parsers of the sub-classes need to get passed back up to the
super-class.

Does this make sense?  I did this kind of thing all the time with lingo,
but since I've been reading Moock I'm trying to write better OOP.  This
has got to be a pretty common thing to run across.

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


___
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] Floating point pain

2007-06-05 Thread Mark Winterhalder

On 6/5/07, Merrill, Jason <[EMAIL PROTECTED]> wrote:

Thanks, yeah, I thought of that.  I was hoping there was some unknown
Math function I had missed.


The only other one I can think of is modulo. It would be slightly more
readable (IMHO) and fit into one line, but would still require the
Math.round, * 100, / 100 thing due to the imprecision of floats.

var fract = Math.round(( val % 1 ) * 100) / 100;

Mark
___
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] Help me "disect" some Flash work please?

2007-05-30 Thread Mark Winterhalder

I'm a programmer who would be relying on an art
department to provide all the media, but I'm just not sure how to "set
it up"... does this make sense?


...and being a programmer is why you don't know how to do it. :)

I'm not sure anymore (too much of a programmer that shuns the timeline
myself), but you can have sound on the timeline. You'll see the wave
form on the timeline when you got it right, IIRC. That way, the
framerate is enforced (the only way to enforce a certain framerate
that I know of), meaning, the sound will play and frames are skipped
if rendering doesn't keep up.

So, there's not much to do for you. Odds are, if you tell the art
department to have some sound on the timeline and then add
synchronized animation to it, they'll automatically do it right
without further instructions. This is "classic" Flash -- remember it
used to be an animation tool and you need to be able to sync sound to
an animation for it to be useful.

The alternative probably would be to read the position in the clip and
jump to the theoretical frame of the animation, or to have a FLV with
metadata events at certain timestamps. Check out
.

HTH,
Mark



On 5/30/07, LHWH Interactive <[EMAIL PROTECTED]> wrote:

These three "presentations" really have nothing in common except a
couple of things I'm trying to figure out, but haven't ever actually
done before, so I'm kinda lost.

What I'm most interested in is, how *technically* do they synchronize
the sound so well to the animation? I notice that no matter what kind
of connection you're on, they all seem to run pretty well, and seemed
to be synchronized pretty well.

Have they split the soundtrack into smaller chunks?
Are they somehow using "cuepoints" and actionscript to "direct" the
animation and timeline?

In my head, I see the sound as a separate movieclip that's being
loaded with actionscript, and then cuepoints in the audio are kicking
the playhead forward thru an animation, then stopping the playhead to
wait for another "cue". Am I close?

How would you set these up, technically speaking, from a production standpoint?

Please, I know the "design" of them is all over the map, and I'm aware
that there's actual video (greenscreened) in one, but generally, they
all seem kinda like the same beast.

Has anyone put together one of these sort of "powerpoint-y"
presentations using flash with a voiceover track and synchronized
animation to it? What pitfalls and advice could you offer? I'm fairly
good at general Flash, and I don't think this is beyond my "realm" of
work in Flash. I'm a programmer who would be relying on an art
department to provide all the media, but I'm just not sure how to "set
it up"... does this make sense?

Below are three of these types of presentations that I was just
randomly able to locate, but this is almost exactly what we want to
try...

http://www.dv3productions.com/E2IT/

http://software.emc.com/products/software_az/replistor.htm
(on this page, click on the "orange box" labeled "View product demo")

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


Re: [Flashcoders] Site structure with classes

2007-05-29 Thread Mark Winterhalder

On 5/29/07, misa <[EMAIL PROTECTED]> wrote:

Hello group,
I'm wondering is there something like 'the best way to structure a flash
site'.


Sure, but unfortunately the diagram has been used as a coaster for the
holy grail and is stained beyond readability. :)


How should the classes be named, should we use frames in the root
timeline and should we use frames at all (expect for animations)? Any
advice or help is welcome!


It really depends on what you plan to do and what you're comfortable
with. Maybe check out  or some other
framework -- maybe you'll find something that fits.
Personally, I don't particularly like the timeline and perceive it as
limiting, although I recognize that it can be useful in certain cases.
As for naming classes, 'descriptive' would be the word I'd use to
describe best practice.

Mark
___
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] objects can't delete themselves right?

2007-05-25 Thread Mark Winterhalder

On 5/26/07, Steven Sacks <[EMAIL PROTECTED]> wrote:

Correct me if I'm wrong, but I thought objects could not delete
themselves, and if you delete an object with a function and store a
reference to that function before you delete it, that function is
orphaned and will never be cleaned up by the GC.  Am I wrong?


Well, you can't (directly) delete objects of any kind (and that
includes functions) /at all/. Only the GC can delete objects. All you
can do is to delete references to that object so that the GC will
(eventually) pick it up.
'foo' is not an object. It's merely a reference. So, when you 'delete
foo', it doesn't do anything to the object, it just removes one of
possibly many references to that object, and if foo happens to be the
last one, the GC will take care of it. When you delete that reference
from within a function it makes no difference whether that function is
referenced by one of the properties of the object foo is a reference
to -- the object and the function exist independently from each other.

I'm sure you know the "copy by reference" thing, I just want to
emphasize for correctness sake that, while it's OK to casually speak
of 'foo' being a certain object, it's still important to keep in mind
that the object has no name (actually, I think MovieClips /do/ have a
string reference in the old VM, but I'm not entirely sure), and that
'foo' is only one of possible many references. Also, one should
remember that functions are some weird kind of object and that the
same function can be called in any scope that pleases you, by using
Function.call() or Function.apply(), or by creating a reference to it
as a property of some object and then calling that reference on the
object.

Anyway, in the case you describe later in this thread, all this makes
no difference, Delegate or not. Removing B's reference to the Delegate
(the event handler) shouldn't even be necessary -- when there is no
more reference to the instance of B, then its reference to the
Delegate gets removed along with the instance, and since it's the last
(only) reference to the Delegate that gets removed, too.

I guess all this was a verbose way of saying you're right, your
objects will be cleaned up, no need to worry.

Mark
___
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 creating an old-skool arc or circularscrollbar

2007-05-24 Thread Mark Winterhalder

On 5/24/07, Carl Welch <[EMAIL PROTECTED]> wrote:

Seems to me you guys are doing this the hard way. Why not just draw a
curved line (with the line tool) then use code to attach/snap the
handle to the line, and then just use actionscript to track the Y
position of the handle and scroll accordingly? Trig for a simple
scroller seems a little convoluted way of going about this simple
thing...The end user will never know or appreciate the difference
anyway.


It depends on your perspective, mainly to what you're used to. Even
with your description, it would take me significantly longer to do it
your way -- that is, if I used the Flash authoring tool in the first
place, which I don't have/want/need. So, coding it isn't the hard way,
for me and many others, at least. That it involves trigonometry (in my
example only for setting an angle and using Math.atan2()) doesn't
automatically make it difficult for everybody. I don't consider myself
to be good at trigonometry, but some basic things I know, and I have
had many, many occasions where knowing that x = Math.cos( angle ) and
y = -Math.sin( angle ) was useful.
Also, by coding it, I could make it a reusable class -- just pass the
radius and the handle (or the radius and the container along with a
linkage name). What if the radius would depend on the stage size? What
if the handle would have to be rotated (say, the hand of a clock).
With a script, you gain flexibility.

Mark
___
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 creating an old-skool arc or circularscrollbar

2007-05-23 Thread Mark Winterhalder

On 5/23/07, Jesse Graupmann <[EMAIL PROTECTED]> wrote:


Trigonometry


No need, apart from Math.atan2() to get the result -- assuming the
anchor point of the container is in the middle, just normalize the
vector from the centre to the mouse and then scale it to the desired
radius, that's the position of the handle.

About like this:

var xmouse = ...
var ymouse = ...
var radius = ...

var magnitude = Math.sqrt( xmouse * xmouse + ymouse * ymouse );

var x = xmouse / magnitude * radius;
var y = ymouss / magnitude * radius;
var angle = Math.atan( ymouse, xmouse ); // devide by Math.PI * 180 if you wish
// now set the position of the handle to x, y and broadcast an event
with the angle.

If you want to set it to a certain angle (in radians), it should be
something like...

var x = Math.cos( angle ) * radius;
var y = Math.sin( angle ) * -radius;

...which might turn into the wrong direction or be set off by
Math.PI/2, in that case, flip the sign of y and/or add/subtract
Math.PI/2 to the angle.

HTH,
Mark
___
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] Motion to combine coders and newbies.

2007-05-14 Thread Mark Winterhalder

On 5/14/07, Danny Kodicek <[EMAIL PROTECTED]> wrote:

I understand the theory but unfortunately there's a down-side. For *reading*
lists, it's great to have them categorised in this way, but for *posting* to
them, it can cause problems. As a Director user, I have quite a few lists to
choose from, among which are Dir3d-l, devoted to 3d issues, and dirGames-L,
devoted to games programming (in Flash too, incidentally - it's a good list
and might benefit from some Flash heads). Now, when I have an issue related
to 3d in a games context, which list do I post to to ensure the right people
read it? Either I have to choose one or the other, resulting in missing out
on some potential advice, or I cross-post, with the result that those who
read both lists (a fair proportion) get two copies of the same message.
Neither really is ideal. In the end, a general list for experts can be more
useful, with a serious naming and shaming of those who post messages with
crappy subject lines.

I'm not saying the idea is unworkable, but it's worth pointing out what we
lose by it.


Hmm... Good point. There probably would be plenty of cross posts.
Still, I believe there are aspects that could be separated. The Flash
JS API. mx.*. Stuff like that. There probably are special lists for
those, but if they would be under the same Figleaf umbrella it would
be easier to refer people to it and the community would stay intact.

Anyway, I would very much appreciate a Flash oriented list discussing
design (in the technical sense). If somebody knows of something like
that, please let me know.

Mark
___
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] Motion to combine coders and newbies.

2007-05-14 Thread Mark Winterhalder

On 5/14/07, Merrill, Jason <[EMAIL PROTECTED]> wrote:

I appreciate the arguments and kind words, but I vote to keep them
separate.  Here's why:


I agree, and just signed up for the "community service".

Over the years, I found I read FlashCoders less and less. FlashCoders
used to be a "must-read" list a few years ago. What I learned from
this list is invaluable. You could stay up to date with what was
happening in the Flash world and learn everything you needed to know
just by reading this list, there was no need for anything else.

For me, this has changed for several reasons, some of them personal
(switching to haXe, not using mx.* and simply knowing more by myself),
some of them related to the growth of the Flash Platform itself (it
used to be possible to know and use pretty much everything related to
AS coding, nowadays there simply are too many aspects to it for them
to be relevant for everybody -- common component kits, video or not,
RIA development or fancy menus, AS1/2/3, FMS, various OS projects, the
list goes on), and, yes, questions that should better be posted on
Newbies. The latter can be solved by making that list more attractive,
i.e. by signing up and helping out as Jason suggested.

But generally, I'd rather have FlashCoders split up into /more/ lists
rather than combining it with FlashNewbies. A list each for AS2, AS3,
FMS, architecture, components and so on. We could then choose which
ones to subscribe to, and those of us gifted with the seemingly rare
ability to set up email folders could organize them as they please.
For me, personally, that would mean I'd subscribe to all and collect
those I'm not currently interested in in a general knowledge-base
folder for possible later use. That would reduce the number of mails
that I personally consider noise (although they are perfectly
legitimate in a general FlashCoders list) and thus greatly increase
the value the rest has for me, making me read more of it. I imagine
that would work the same for most.

My 2ct. Just an idea.

Mark
___
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] Flash chat options

2007-05-11 Thread Mark Winterhalder

Maybe have a look at the Oregano server:


HTH,
Mark


On 5/11/07, Mick G <[EMAIL PROTECTED]> wrote:

Does anyone have any suggestions to the best way to implement a Flash based
chatroom (Can be commercial, but I have a low budget). I'm after something
that utilizes a free XML socket server and something that works efficiently
on a server without any nast polling.

I've tried implementing ElectroServer but it wasn't really an option with my
current hosting situation and in general the documentation on the site
seemed sparse.

I don't anticipate many more than 20-30 concurrent users.


Any links/help appreciated thanks,
Mick
___
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


  1   2   3   >