Re: [Flashcoders] encrypt string (fast)

2007-08-18 Thread Tyler Wright
I would think the built-in ByteArray.compress would be much faster than 5-10
seconds for a simple 100k string. But if it doesn't work, a really simple
method of "encrypting" a string is doing a bit-flip on each character ...

// your original string (try this out with large files)
var str:String = "123456789";
var newStr:String = "";

// some random number between 0 and 255
var bitFlip:uint = 76;
for(var i:uint = 0; i < str.length; i++)
{
// using the bitFlip value do an XOR on the character
newStr += String.fromCharCode( str.charCodeAt(i) ^ bitFlip );
}
// new string is un-readable
trace(newStr);
// to translate back to the original string, simply flip
// the character back using the same bitFlip value
str = "";
for(i = 0; i < newStr.length; i++)
{
str += String.fromCharCode( newStr.charCodeAt(i) ^ bitFlip );
}
// once again you have the original
trace(str);


Even if it's not real security, it's always a heap of fun. Good luck!

Tyler


On 8/16/07, Mick G <[EMAIL PROTECTED]> wrote:
>
> I've tried different compressions classes - they're just too slow (even
> with
> some I tried that throw "chunks" of data at the class in intervals, it
> still
> took 5 - 10 seconds.
>
> And yes the purpose is to make it unreadable.
>
> I've written a very simple function that replaces the numbers 1 - 20 with
> custom characters using split.join. It performs this in 170 milliseconds
> to
> encrypt (and takes about 10% off the file size since in some instances I'm
> replacing 2 characters with 1).
>
> I guess using split and join is much faster than I thought.
>
>
>
> On 8/16/07, elibol <[EMAIL PROTECTED]> wrote:
> >
> > Why do you need to encrypt it? If you just need it unreadable, then why
> > not
> > kill two birds with one stone and compress it?
> >
> >
> >
> http://www.razorberry.com/blog/archives/2004/08/22/lzw-compression-methods-in-as2/
> >
> > On 8/16/07, Mick G <[EMAIL PROTECTED]> wrote:
> > >
> > > I need a way to encrypt a LARGE string (up to 100k of text) - my data
> is
> > > mostly xy coordinates so 90% numbers.
> > >
> > > I've tried a few AS encryption classes that I've found online and
> > > considering I have such a large string, they're all too slow. It
> doesn't
> > > need to be too secure - decryption speed is more import than security.
> > >
> > > I was thinking of just doing a simple custom character replace with
> > > split.join replacing each numeral 0-9 with a character, but does
> anyone
> > > have
> > > any other ideas on a efficient/fast way of doing this?
> > >
> > > - 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
> >
> ___
> 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] swf and referring domain

2006-11-18 Thread Tyler Wright

Mick,

You don't need the import (in AS2) if you type out the full package name:
flash.external.ExternalInterface(...);

Tyler

On 11/17/06, Mick G <[EMAIL PROTECTED]> wrote:


Two lines...

*import* flash.*external*.*ExternalInterface
*var thisDomain:String = flash.external.ExternalInterface("eval", "
location.href");

I always forget that damn import and it kills me wasting time debugging it
;)





On 11/17/06, Tyler Wright <[EMAIL PROTECTED]> wrote:
>
> Dave,
>
> If you were just using Flash8 ... it's beautiful.
>
> var thisDomain:String = flash.external.ExternalInterface("eval", "
> location.href");
>
> one line, so sweet.
>
> Tyler
>
> On 11/15/06, Dave Segal <[EMAIL PROTECTED]> wrote:
> >
> > Is there a way to find the domain of the page that loads my swf. For
> > example, someone embeds an swf served from my server on their
> > www.myspace.com <http://www.myspace.com/>  page. Is there is way for
me
> to
> > determine that the request is coming from myspace.com at runtime?
> >
> > A search of the archive revealed this thread that describes exactly
the
> > problem that I am facing but I didn't see any solution.
> >
> >
>
http://chattyfig.figleaf.com/pipermail/flashcoders/2006-October/175064.html
> >
> > I have the option of using AS 3 if it provides a solution.
> >
> > 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
>
___
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] swf and referring domain

2006-11-17 Thread Tyler Wright

Dave,

If you were just using Flash8 ... it's beautiful.

var thisDomain:String = flash.external.ExternalInterface("eval", "
location.href");

one line, so sweet.

Tyler

On 11/15/06, Dave Segal <[EMAIL PROTECTED]> wrote:


Is there a way to find the domain of the page that loads my swf. For
example, someone embeds an swf served from my server on their
www.myspace.com   page. Is there is way for me to
determine that the request is coming from myspace.com at runtime?

A search of the archive revealed this thread that describes exactly the
problem that I am facing but I didn't see any solution.

http://chattyfig.figleaf.com/pipermail/flashcoders/2006-October/175064.html

I have the option of using AS 3 if it provides a solution.

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] Find item in array

2006-09-20 Thread Tyler Wright

He's right, and declaring the variable i inside of the loop rather than
before actually (weirdly) runs faster. I don't know what pcode it produces,
but I know CPU doesn't care about pcode. I think the only way to test speed
is timing the thing. It's all very interesting, but I doubt even 10 ms of
difference over 10,000 iterations could ever be noticable to the user. It
certainly won't be the difference between a script timeout or not. I like
the for..in for its simplicity ... also it helps avoid endless looping and
other unexpected behavior if you're adding to or taking away from the array
while the loop is running.

I agree, AS3 rocks! I'm done with 275 ms if I can have 7 ms. Thats 39 times
faster! geesh

Tyler

On 9/19/06, JOR <[EMAIL PROTECTED]> wrote:


Actually, Tyler's tests proved that "var a in" is faster with today's
player.  I tried his test out myself and my results were even wider than
his.  I published for AS2 and ran in Flash Player 9.  I was averaging
roughly 265ms for "var a in" and 275ms for "(--a -(-1))".

Then I compiled for AS3 and it ran too fast for testing at 7ms for
both  AS3/Player 9 rocks!!!

So, I added another 9 to the loop counter making it 9 iterations.
Then "var a in" ran at 70ms, (--a -(-1)) and (a--) ran the same at 77ms.

Then I added another 9 making the loops 99.  "var a in" ran at
740ms, (--a -(-1)) ran 765ms and (a--) at 770ms.

I'm satisfied that "for (var a in array)" is faster than "while (--a
-(-1))".  Perhaps in the past that wasn't always the case, but with
player 9 it is the case and that's what I'll be basing my decisions on.

James O'Reilly
http://www.jamesor.com



Steven Sacks | BLITZ wrote:
>>using a for..i..in loop will always be faster
>
>
> It's been proven before here on flashcoders that for in is not faster
> than --a -(-1) because it compiles to more lines of pcode.  I guess it's
> time to use Flasm to bust out some pcode and post it here on the list
> instead of making claims based on hunches and past posts in the
> archives.
>
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


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

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


Re: [Flashcoders] Find item in array

2006-09-19 Thread Tyler Wright

:)

So, for the sake of another one of those big arguments over what's better
where no one ever test, I wrote some code to find out exact results:

The following code executes one particular test on my Windows XP machine.
For results I got an averate of 347 miliseconds executeing the --i -(-1) and
343 ms with the for..in loop. I was surprised at how close they were. Now
that being the difference over 10,000 iterations, I can't really say for..in
is much faster, if at all. Perhaps the results are different on someone
else's machine, or perhaps different results from a different type of array.
Now iterating through the entire array the for..in did seem to be faster,
but for the test I chose a value directly in the middle so each method had
the same amount of value's to cover. anyway, I conclude nothing. ;)

except that we should always test our results.

Tyler

var myArray:Array = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"l", "m", "n", "o", "p"];

var time:Number = getTimer();
var loop:Number = ;
while (loop--)
{
   /*/
   var j:Number = myArray.length
   while (--j -(-1)) {
   if(myArray[j] == "h"){
   break;
   }
   }
   /*/
   for (var j in myArray)
   {
   if (myArray[j] == "h")
   break;
   }
   //*/
}
trace(getTimer() - time);

// 347
// 343

On 9/19/06, Merrill, Jason <[EMAIL PROTECTED]> wrote:


using a for..i..in loop will always be faster. Even more then --a
-(-1)

I'm ducking and running for cover.

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





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

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


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

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


Re: [Flashcoders] Find item in array

2006-09-19 Thread Tyler Wright

for (var i:String in myArray)
{
   if (myArray[i] == value)
   return Number(i);
}

using a for..i..in loop will always be faster. Even more then --a -(-1)
iteration. Unless you can guarentee that your element will always be near
the beginning of a large array, as the for..i..in starts from the back. I
recommend using this loop anywhere you need the most speed and order doesn't
matter, as in this case.

Tyler



On 9/19/06, Steven Sacks | BLITZ <[EMAIL PROTECTED]> wrote:


I guess what it depends on is what you're doing with that for loop.

If you're using it to attach or create or animate movieclips, or parse
through xml or a recordset, or anything that would make Flash
unresponsive during the loop, then the benefits of while (--a -(-1))
outweigh the readability compared to while (a--).

As a result, I use it pretty often.  ;)

So, now I just end up using it for everything since it's become a habit.
The flipside is that sometimes I need to do forward loops for
reiterating to maintain proper order.  However, I would have to do that
anyway regardless of which backwards looping method I used.

___
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] |:::| can you write dynamic meathods in a class?

2006-08-14 Thread Tyler Wright

If you're already using a custom Delegate, why not modify the thing to
handle what you've just provided?

var clickHandler:Function = MyClass.staticMethod;
var args:Array = ['Can', 'pass', 'in', 'any', 'amount'];
newBtn.addEventListener("click", Delegate.create2(this, clickHandler, args
));
// (I'm sure you could think of a better name than 'create2' though)

that's all a Delegate is doing is an apply. It's not magic, not really.

Tyler

On 8/13/06, Bjorn Schultheiss <[EMAIL PROTECTED]> wrote:


Hey Guys, check this out


Var clickHandler:Function = MyClass.staticMethod;
var args:Array = ['Can', 'pass', 'in', 'any', 'amount'];
newBtn.addEventListener("click", Delegate.create(this,
function(evt:Object,
meth:Function, args:Array) { meth.apply(null, args) }, clickHandler, args
)
);



Regards,

Bjorn Schultheiss
Senior Flash Developer
QDC Technologies

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of dnk
Sent: Monday, 14 August 2006 5:17 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] |:::| can you write dynamic meathods in a
class?

Ramon Miguel M. Tayag wrote:
> Sometimes some events pass their own args and you dont even see them..
>
> Try changing your function to this:
>
> function onHit1(o:Object, n:Number) //the o object is passed by the
> listener {
>trace("it was hit with the number: " + n); }
>
That worked perfect!!!


Thanks sooo much!

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

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com
___
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] Possible Challenge: AS 3.0 Compiler :)

2006-08-08 Thread Tyler Wright

It would be great to have the specs for AS3 just to modify current swfs in
other ways (not necessarily compile from scratch). Obfuscation comes to mind
...

Someone will do really well with an AS3 compiler ... so, who wants to start
an AS3 compiler in AS3?! I'd be interested.

Tyler


On 8/6/06, SWF Coder <[EMAIL PROTECTED]> wrote:



> Can flex compiler run inside the Flash 9 plugin?

No Way!

>No need to be snappy. I didn't understand. I suppose
you could write
>it using the new byte array stuff, but I don't
understand why it would
>be of any use to anyone. If you want something
compiled it would make
>a lot more sense to get a serverside language to call
the compiler.

It makes more sense as an interpretur to execute some
scripts on the client-side.
I wonder if there is a parser generator that could be
used with AS3?
Anyway, what the new byte array has to do with it?

>> Possibly for geek points?
>A compiler is a lot of work. If you have time to
kill, why not spend
>it on something worthwhile.

Not if you used a parser generator. Plus, it's fun ;)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


___
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] Possible Challenge: AS 3.0 Compiler :)

2006-08-04 Thread Tyler Wright

There is an attempt underway to document the SWF 9 bytes for a disassembler.
I'm sure this could be the start of a compiler as well. And unfortunately I
don't think Adobe will release the specs any time soon.

http://osflash.org/swf9dis

Tyler

On 8/2/06, John Giotta <[EMAIL PROTECTED]> wrote:


It maybe too soon for anyone to have a full grasp on AMF or SWF specs
of an AS3.0 SWF but I wonder if its possible to create a crude
compiler from AS3.0.

AS3.0 ouroboros of sorts.
___
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] AS3 faster ??

2006-07-10 Thread Tyler Wright

ActionScript 3.0 overview
http://www.adobe.com/devnet/actionscript/articles/actionscript3_overview.html

Programming ActionScript 3.0
http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/js/html/wwhelp.htm?href=Part5_ProgAS.html

ActionScript 3.0 Language Reference
http://livedocs.macromedia.com/flex/2/langref/index.html

I've found these to be great references, and I believe they're really the
only ones available.
Colin Moock is writing an AS3 reference as well, though I don't know when
it's scheduled to come out.

Tyler

On 7/10/06, Tom Jackson <[EMAIL PROTECTED]> wrote:


hey andreas you say AS3 isn't a difficult language to learn for as2'ers,
is
there any comprehensive books or courses out yet I could dive into?

On 10/07/06, Andreas Rønning <[EMAIL PROTECTED]> wrote:
>
> Hardly benchmarks, but you can get a quick comparison in flashplayer 9:
>
> http://andreas.rayon.no/AS2.swf
>
> Press the 3-key on your keyboard to load the most complex system,
> observe the BREAKNECK SPEED at which Flash player 8 handles it.
>
> http://andreas.rayon.no/AS3.swf
>
> I rest my case :)
>
> - Andreas
>
>
> Nick Weekes wrote:
> > Andreas, you got any links to your benchmarking?  Id be interested to
> see
> > them (Im not planning on migrating to AS3 just yet).
> >
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of
Andreas
> > Rønning
> > Sent: 10 July 2006 14:59
> > To: Flashcoders mailing list
> > Subject: Re: [Flashcoders] AS3 faster ??
> >
> > I did an l-system implementation in AS2 recently. In FP8 i could only
do
> > simple systems with a couple of recursions before the player choked,
and
> > playback was slow as well (i animated the growth with perlin noise for
a
> > wind effect). Porting to AS3 let me quadruple the l-system complexity,
> still
> > get instantaneous results and far, far better playback speed.
> >
> > Not hard numbers, i know, but pretty mindblowing for me to watch as a
> > developer.
> >
> > AS3 doesn't wrap AS2, this is important to remember. AS2 was pretty
much
> > AS1 with knobs on, AS3 is a new language to learn (albeit not a tough
> one to
> > learn if you're used to AS2).
> >
> > - Andreas
> >
> > neo binedell wrote:
> >
> >>Of course it will be faster only if you port the code over to AS3
> >>(otherwise it will still use the old AS2/1 VM1).
> >>
> >>I posted about the 3D engine I wrote and the speed increase I got when
> >>I converted it to AS3 a few days ago so you can check that out as an
> >>example of just how much faster it is ;p
> >>
> >>~neo
> >>
> >>-Original Message-
> >>From: [EMAIL PROTECTED]
> >>[mailto:[EMAIL PROTECTED] On Behalf Of
> >>Patrick Matte
> >>Sent: 06 July 2006 05:47 PM
> >>To: Flashcoders mailing list
> >>Subject: [Flashcoders] AS3 faster ??
> >>
> >>Hi people, they say that AS3 is 10 times faster than AS2 but what does
> >>that really means ? Does that mean that my movies will play faster
> >>even if I have a few dozens movieclips with graphics flying all over
> >>the screen? Or does it just mean that my .swf will be compiling 10
times
> >
> > faster?
> >
> >>
> >>___
> >>Flashcoders@chattyfig.figleaf.com
> >>To change your subscription options or search the archive:
> >>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>
> >>Brought to you by Fig Leaf Software
> >>Premier Authorized Adobe Consulting and Training
> >>http://www.figleaf.com http://training.figleaf.com
> >>
> >>___
> >>Flashcoders@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
> >
> >
>
> --
>
> - Andreas Rønning
>
> ---
> Flash guy
> Rayon Visual Concepts, Oslo, Norway
> ---
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


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

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting

Re: [Flashcoders] Tabbed Browsing support? htmlText, contextMenu, Javascript?

2006-07-05 Thread Tyler Wright


Note: For those from Adobe that read this list ... With IE7's release and
it's support for tabbed browsing, if Flash Player provides no support for
opening links in tabs it will be increasing apparent that Flash Player is
essentially unaware of tabbed browers.)



I believe JavaScript is also fully unaware of tabs in any browser, and
JavaScript is the browsers own language. I am sorry but tabs are still very
browser specific and not exposed yet to any programatic API's available to
Flash. The only solution currently is to implement browser-specific plugins
that can communicate with the webpage through JavaScript. Good luck
convincing internet users that they'll need such a plugin.

If I find anything more that might look like a possibility I'll post it to
the list, but I think you're out of luck.

Tyler
___
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: Programmatically instantiating a class thatextends MovieClip

2006-07-05 Thread Tyler Wright

There's a really light class called Prototype which is free to download at
http://codext.com/code/9. It does the same thing except with full
constructor support. It also has a really simple/clean API:

mc = createEmptyMovieClip("mc", 1);
Prototype.makeInstanceof(mc, MyMovieClipClass);

thats it! I've loved it ... works on extending other elements too, like
TextFields or _root (I use that one constantly).

Tyler


On 7/3/06, Bernard Visscher <[EMAIL PROTECTED]> wrote:


I've tested the following a while ago and it works perfectly.
It uses the acme ClassUtilities class.

MovieFactory:

import com.acme.ClassUtilities;

class nl.debit.util.MovieFactory {

private static var instance : MovieFactory;

public static function getInstance() : MovieFactory
{
if (instance == null)
instance = new MovieFactory();
return instance;
}

private function MovieFactory()
{
ClassUtilities.registerPackage();
}

public static function
createMC(target:MovieClip,id:String,className:Function):MovieClip
{
if (instance == null)
instance = new MovieFactory();

if(!className.symbolLinked)
{
var classPath:String = ClassUtilities.getPath(className);
className.symbolName = "__Packages." + classPath;
className.symbolLinked =
Object.registerClass(className.symbolName,className);
}

return
target.attachMovie(className.symbolName,id,target.getNextHighestDepth());
}
}


MyClass:

class MyClass extends MovieClip{

public function MyClass() {
beginFill(0x00);
moveTo(0,0);
lineTo(100,0);
lineTo(100,100);
lineTo(0,100);
lineTo(0,0);
endFill();
}
}

Then use in your code:

var mClip:MovieClip = MovieFactory.createMC(_root,"test",MyClass);


Greetz,

Bernard

> -Oorspronkelijk bericht-
> Van: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Namens
> Costello, Rob R
> Verzonden: maandag 3 juli 2006 17:05
> Aan: flashcoders@chattyfig.figleaf.com
> Onderwerp: [Flashcoders] Re: Programmatically instantiating a
> class thatextends MovieClip
>
> As a variant on the __proto__ method (which I gather is what
> the compiler actually uses behind the scenes anyway) I also
> bundle the code into a static method
>
>
>
>
>
>  Class A {
>
> ...
>
>
>
> // dynamicMc (no library symbol) will be added and subclassed
> to mcSubClass
>
> dynamicMc:MovieClip  = McSubClass.addInstance(baseMC);
>
> }
>
>
>
>
>
> class McSubClass extends MovieClip{
>
>
>
> function McSubClass {
>
>   //empty constructor
>
> }
>
>
>
> function init(){
>
>
>
>   //initialize mc - add dynamic graphics etc
>
>
>
> }
>
>
>
> static function addInstance (base_mc) {
>
>
>
> var newMc;
>
> var nd = base_mc.getNextHighestDepth();
>
> newMc= base_mc.createEmptyMovieClip("mcSubClass"+nd,nd);
>
> newMc.__proto__ = new McSubClass ();
>
> newMc.init();
>
> return newMc;
>
> }
>
>
>
>
>
> }
>
>
>
> maybe mc.__proto__ == MyClass.prototype (below) is better
> than my  newMc.__proto__ = new McSubClass ()
>
> my method (i picked up on this list) does have the side
> effect that the constructor can't initialize the mc, hence
> the separate init call after the __proto__ / constructor; all
> wrapped in one method so I don't forget
>
>  Rob
>
>
>
>
>
> > Subject: Re: [Flashcoders] Programmatically instantiating a
> class that
>
> > extends MovieClip.
>
> > To: "Flashcoders mailing list" 
>
> > Message-ID:
>
> > <[EMAIL PROTECTED]>
>
> > Content-Type: text/plain; charset=UTF-8; format=flowed
>
> >
>
> > Hello :)
>
> >
>
> > it's easy, you must use __proto__
>
> >
>
> > AS2 - MyClass extend MovieClip !!!
>
> >
>
> > MyClass extends MovieClip {
>
> >
>
> >  // o Constructor
>
> >
>
> >  public function MyClass() {
>
> >
>
> >  }
>
> >
>
> > }
>
> >
>
> > 
>
> >
>
> > var mc = createEmptyMovieClip("myInstance", 1) ;
>
> > mc.__proto__ == MyClass.prototype ;
>
> > MyClass.call(mc) ;
>
> >
>
> > EKA + :)
>
> >
>
> >
>
> >
>
> >
>
> > 2006/6/29, Scott Hyndman <[EMAIL PROTECTED]>:
>
> > >
>
> > > That's exactly what I mean. As a result you can do cool
> things like
>
> > > reparenting -- like moving a button from one window to another. It
>
> > > handles the MovieClip creation itself.
>
> > >
>
> > > A code example really isn't too easy, because the framework that
>
> > > allows this to be possible is quite large. If you were really
>
> > > interested, you could look at the code. Here's a link:
>
> > >
>
> > > http://tinyurl.com/jqtwv
>
> > >
>
> > > It's a gigantic class...so it might be difficult to work through.
> > > The
>
> > > important method is createMovieClips(), which is called
>

Re: [Flashcoders] Ajax and ActionScript 2.0

2006-07-02 Thread Tyler Wright


Could somebody share with me 1 example where "AJAX"/XMLHttpRequest
succeeds where Flash fails ?



The term AJAX is thrown around loosly these days to sometimes mean
anything JavaScript.
I've seen both Flash using JavaScript and JavaScript using Flash (FJAX) for
server communication. I can't say how much either solution makes sense, but
at least they're working together instead of succumbing to the old Flash vs.
JavaScript and Which is Better? debate. There are so many useful things they
can do together. Look for the Browser Power for Flash session at the next
FlashForward. It is all about Flash and JavaScript and some really cool
stuff they can do ... well worth your time. There will also be some previews
on the subject coming soon to uFlash.org.

Tyler


ps. don't mind this email if you've received it before. It's being resent
because of an initial failure to send.
___
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] Ajax and ActionScript 2.0

2006-06-28 Thread Tyler Wright


Could somebody share with me 1 example where "AJAX"/XMLHttpRequest
succeeds where Flash fails ?



The term AJAX is thrown around loosly these days to simply mean anything
JavaScript. For those interested in learning more about Flash and JavaScript
drawing on one anothers strengths look for the Browser Power session at the
next FlashForward. It will be well worth your time.

Tyler
___
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] is extending TextField usable with AS2?

2006-06-16 Thread Tyler Wright

it would seem manuals are written by people. People can be wrong, and are in
this case.

TextFields, MovieClips and Buttons are all AS classes that can be extended.
Each class ships with set of methods and properties that are present in the
subclass. However, most of those props/methods will only work if the
instance object happens to be a display object instance with which the super
class is associated.

Understanding this gives you the ability to do some cool things. Did you
know that you can give the TextField class the getBounds, swapDepths, and
other useful functions that only the MovieClip class has and it works like a
charm:

TextField.prototype.swapDepths = MovieClip.prototype.swapDepths;

Also, you can take any TextField already in existance and make it an
instance of your subclass. The docs are wrong, you can subclass a TextField,
it just doesn't do you much good without a method of instantiation:

mc.createTextField("tf", 0, 0, 0, 100, 20);
Prototype.makeInstanceof(mc.tf);

Prototype is the class I've created to make such a process feel less dirty
to OO purists who still don't realize that all AS2 is AS1 in the end.

This class is available on http://codext.com and will be a core class of the
Flight component set. There are always solutions.

Tyler


On 6/16/06, Michael Stuhr <[EMAIL PROTECTED]> wrote:


Merrill, Jason schrieb:
>>> Peter O'Brien schrieb:
 title says it all really, I'd prefer not to use prototype, is there
> anyway I
 can make an instance of my AS2 extension of TextField?
>
>>> RTFM where it says all about classes.
>>>
>>> micha
>
> Come on now micha, play nice.  It's not like the "manual" has a section
> in classes about extending TextFields -
now you got me: no, it hasn't but creating subclasses is in there.

> You cannot extend the TextField class or static classes
(from: http://livedocs.macromedia.com/flash/8/main/1359.html)

took me 1 minute to find.

search the archives is an option too:
<
http://chattyfig.figleaf.com/mailman/htdig/flashcoders/2005-March/134251.html
>

don't we have a nettiquette ?

micha
___
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] FlashVars + OOP, Best Practices?

2006-06-07 Thread Tyler Wright

Oops, I didn't read your full article. You solve those problems with
your extend
FlashVars suggestion! Singleton still doesn't make sense in this situation.
If you make the class a static that automatically parses _level0 you'll be
set (FlashVars will never be found anywhere but _level0 and they'll be
available right from the beginning. I know there are some who will want to
argue that this is a dependency but that could be similar to arguing that
the MovieClip is a dependency -- it's a documented and supported feature)

Tyler

On 6/7/06, Tyler Wright <[EMAIL PROTECTED]> wrote:


I never really understood how making an anonymous object and it's
properties into a dynamic class suddenly made it object oriented. Singleton
especially seems to be a vice for that type of thing.

The reason you would abstract the FlashVars is to 1) avoid naming
conflicts and 2) to make changes as easy as possible -- all in one place.
With the dynamic Singleton if the naming of the specific FlashVars change
you still have to search through all of your code and update those
references. If, however, your main Application class (specific to your app)
should take those variables and store them by some application-specific
name, you now have a single place for all of your classes to access and one
place to make changes should a backend developer decide mid-project to mix
things up. Singleton or any class are instantly useless as soon as they
perform exactly as an anonymous object (usually involving dynamic and
resolve). I agree that FlashVars should be limited to receiving config
information only at which point an application can gather further
information if needed.

It needs to make sense, not just seem more correct. OOP is a tool for
change and reuse of code. It was never meant to be something for blind
faith.

The suggestions I have for your current class:
1) create a hash table coded to the specific FlashVar class for your
particular app. It should have the FlashVar name as well as a reserved name
given for application use. These can be the same, but if the FlashVar name
were to change it could be updated here and the application would continue
using the value by the app name.

ex.
var hashVars =
{
fv_url:"baseURL",
fv_uid:"userID"
}

2) (what you've got with naming convention is really good, good standard
to have, so this is just an alternative, not a better way) have the class
initiate from a static constructor (so it will happen before frame1 and
before everything really gets going). At this point you can scrub _level0
for each var in your hash table (everything that isn't a MovieClip,
TextField, Button, or the $version property will be a FlashVars). You can
then store them and delete them from _level0 promptly. This will help your
class not be dependant on an arbritrary naming convention.

Tyler



On 6/6/06, Morten Barklund <[EMAIL PROTECTED]> wrote:
>
> Hi Steve,
>
> > 1. Use static methods/properties instead of singleton. Gets rid of
> > '.getInstance().' cruft.
>
> Well. In this case I prefer it used as a singleton - don't know why
> really, but it just seems more correct to me.
>
> > 2. Remove the setVar() method since these properties really should be
> > read only. Move this into your settings class if you need it.
>
> But it's private anyways. Is made to be used by subclasses.
>
> > 3. Use composition in the SomeSettingsClass class rather than
> > inheritance since this isn't an 'is a' relationship.
>
> That would require more code, and the ability to overturn dynamicness
> through inheritance makes this seem preferable to me.
>
> And I actually find the relationship as being an "is a" - as the
> settingsclass would be used only for FlashVars-variables. Other settings
> (read from XML and more) could of course be read in as well, in which
> case composition would be preferable.
>
> But I do follow your concerns on all three matters.
>
> > It's also worth noting that the Flex 2 framework has a nice method of
> > abstracting FlashVars via the Application.application.parametersarray.
>
> Those will be the days... :)
>
> --
> Morten Barklund
> ___
> 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] FlashVars + OOP, Best Practices?

2006-06-07 Thread Tyler Wright

I never really understood how making an anonymous object and it's properties
into a dynamic class suddenly made it object oriented. Singleton especially
seems to be a vice for that type of thing.

The reason you would abstract the FlashVars is to 1) avoid naming conflicts
and 2) to make changes as easy as possible -- all in one place. With the
dynamic Singleton if the naming of the specific FlashVars change you still
have to search through all of your code and update those references. If,
however, your main Application class (specific to your app) should take
those variables and store them by some application-specific name, you now
have a single place for all of your classes to access and one place to make
changes should a backend developer decide mid-project to mix things up.
Singleton or any class are instantly useless as soon as they perform exactly
as an anonymous object (usually involving dynamic and resolve). I agree that
FlashVars should be limited to receiving config information only at which
point an application can gather further information if needed.

It needs to make sense, not just seem more correct. OOP is a tool for change
and reuse of code. It was never meant to be something for blind faith.

The suggestions I have for your current class:
1) create a hash table coded to the specific FlashVar class for your
particular app. It should have the FlashVar name as well as a reserved name
given for application use. These can be the same, but if the FlashVar name
were to change it could be updated here and the application would continue
using the value by the app name.

ex.
var hashVars =
{
   fv_url:"baseURL",
   fv_uid:"userID"
}

2) (what you've got with naming convention is really good, good standard to
have, so this is just an alternative, not a better way) have the class
initiate from a static constructor (so it will happen before frame1 and
before everything really gets going). At this point you can scrub _level0
for each var in your hash table (everything that isn't a MovieClip,
TextField, Button, or the $version property will be a FlashVars). You can
then store them and delete them from _level0 promptly. This will help your
class not be dependant on an arbritrary naming convention.

Tyler


On 6/6/06, Morten Barklund <[EMAIL PROTECTED]> wrote:


Hi Steve,

> 1. Use static methods/properties instead of singleton. Gets rid of
> '.getInstance().' cruft.

Well. In this case I prefer it used as a singleton - don't know why
really, but it just seems more correct to me.

> 2. Remove the setVar() method since these properties really should be
> read only. Move this into your settings class if you need it.

But it's private anyways. Is made to be used by subclasses.

> 3. Use composition in the SomeSettingsClass class rather than
> inheritance since this isn't an 'is a' relationship.

That would require more code, and the ability to overturn dynamicness
through inheritance makes this seem preferable to me.

And I actually find the relationship as being an "is a" - as the
settingsclass would be used only for FlashVars-variables. Other settings
(read from XML and more) could of course be read in as well, in which
case composition would be preferable.

But I do follow your concerns on all three matters.

> It's also worth noting that the Flex 2 framework has a nice method of
> abstracting FlashVars via the Application.application.parameters array.

Those will be the days... :)

--
Morten Barklund
___
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] Conditional Import Statements

2006-06-05 Thread Tyler Wright

The only way is to compile the classes into a seperate SWF's and at runtime
when you make the check load in the appropriate SWF. Not a very simple
solution.

I've found that a good solution, if you can afford to combine the classes
into one, is making a runtime check on functionality.

jsConnection = (ExternalIntervace != null) ? callEI : callGetURL;

function callEI()
{ ... }

function callGetURL()
{ ... }

make sense?
Tyler


On 6/5/06, Janis Radins <[EMAIL PROTECTED]> wrote:


no there is no way
improts are executed at compile time all you can do is to define which
class
to use depending on player version

2006/6/5, Christian <[EMAIL PROTECTED]>:
>
> Hey Guys,
>
> So i'm in the process of writing a class that does a lot of JavaScript
> handling.  The tricky part is, I want to use External Interface for
> those files published in 8 and simple getURL calls for those published
> in 7 or below.
>
> For all intents and purposes, this is a private class that won't be
> exposed to the public, so I can't simply require the user to import
> version 8 of class or version 7 of class.
>
> Is there a way to do a conditional import based on published version,
> instead of runtime version?  I often use $version to detect major
> version of play to handle other functionality, but as you all know
> External Interface breaks if not published in 8.
>
> OR better yet, could I simply just copy the file to the FP7 folder and
> fake it?
>
> Does this make sense or am I smoking crack here?
>
> Christian
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


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

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


Re: [Flashcoders] More on shared fonts and embedding

2006-06-05 Thread Tyler Wright

You're right, unless the font is embedded Flash will render it as a "system
font" which means it will hopefully look as good as other aliased fonts in
the browser, but not better.

My suggestion is to take a look at Rob Taylor's Fontastic, it's pretty
ingenious. You might have to subscribe to his site.

http://FlashExtensions.com

Tyler

On 6/5/06, Danny Kodicek <[EMAIL PROTECTED]> wrote:


Okay, I'm back after the weekend and ready to get this sorted out.

Thanks to various help, mostly Tom, I've got to the stage where objects in
one movie are managing to share a font in another, which at least is what
shared fonts are supposed to do (and is in itself something of a
breakthrough for me). But it's still not right. The problem is that for
dynamic fields, unless I embed the font, it doesn't appear antialiased.
This
means that my 'client' movie has to embed my shared font, but as soon as I
do that, the linkage breaks (quite reasonably). Meanwhile, I'm still
concerted about the low filesize in the 'Official' version: I can't see
how
this can contain all the font information.

I really would appreciate some more thoughts on this. Am I just missing a
trick on how to get these fonts antialiasing correctly?

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] create an object of type defined with a string

2006-06-04 Thread Tyler Wright

If you need an object that already exists to be converted into an instance
of the class you can use the XT Prototype class

Prototype.makeInstanceof(obj, Array);

and using Zimmen's suggestion

Prototype.makeInstanceof(obj, _global[tType]);

good luck! you'll find the class at
http://codext.com/code/9

Tyler

On 6/1/06, Zimmen <[EMAIL PROTECTED]> wrote:


Yes it is... so you could use

function makeObject(tType){
   return (new _global[tType]())
}
test = makeObject("Array")

as well (this is what the findClass method does eventually. :)

On 6/1/06, Danny Kodicek <[EMAIL PROTECTED]> wrote:
> Thanks, Zimmen and Ian, that's helpful. I'll probably go with Ian's
> solution, which seems a bit more robust (I've been caught out before by
> clever tricks using eval()...)
>
> Danny
>
> - Original Message -
> From: "Zimmen" <[EMAIL PROTECTED]>
> To: "Flashcoders mailing list" 
> Sent: Thursday, June 01, 2006 5:33 PM
> Subject: Re: [Flashcoders] create an object of type defined with a
string
>
>
> > This actually works:
> >
> > function makeObject(tType){
> > var tVar = eval(tType)
> > return (new tVar())
> > }
> > test = makeObject("Array")
> > test.push("foo")
> > test.push("bar")
> > trace(test[0])
> > trace(test[1])
> > trace(test.length)
> >
> > Output:
> >
> > foo
> > bar
> > 2
> >
> > On 6/1/06, Danny Kodicek <[EMAIL PROTECTED]> wrote:
> >> I want to have a function makeObject(tType:String) which returns an
> >> object
> >> of class tType. So makeObject("Array") should return a new Array
object.
> >> Any
> >> good way to do this? I'm sure it's something simple.
> >>
> >> And before you ask, yes, there is a reason why I need to do it this
> >> 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
>
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


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

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


Re: [Flashcoders] maxDepth for dynamic movieclips?

2006-06-04 Thread Tyler Wright

You'll love using the XT DepthManager - plus if you read the comments on the
classes static properties there are exact (verified) numbers for max and min
depths supported by the Flash player.

You'll find the class at http://codext.com/code/6

Tyler

On 6/1/06, Zimmen <[EMAIL PROTECTED]> wrote:


Well, when you have a slideshow that shows clips one after the other then
you only really need 2 depths don't you ...
If not, perhaps some sort of depth manager that keeps track of used and
unused depths...


- Original Message -
From: "grimmwerks" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" 
Sent: Thursday, June 01, 2006 3:40 PM
Subject: [Flashcoders] maxDepth for dynamic movieclips?


> I've got an app that's a glorfied slideshow, slowly adding mc's and
> gettingNextHighestDepth() -- at some point I'm assuming it will get to
> the maxDepth; what would be the best way of resetting this?
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>

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

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


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

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


Re: [Flashcoders] SetInterval vs. onEnterFrame

2006-05-24 Thread Tyler Wright

setInterval's use up next to nothing on processor, even if you have 20 of
them going. I find that the best judgement of which to use is the task at
hand.

Because framerate is for animation, I find it best to use onEnterFrame when
doing coded animation. Flash will cause an automatic screen redraw each
frame and because the onEnterFrame executes precisely before this redraw
it's the perfect chance to make display changes and scripted tweens. To keep
processor to a minimum it is good to use only one onEnterFrame because many
of them will make a processor difference. The way to do this is set up an
"enterFrameBroadcaster" ... basically have one onEnterFrame running and
dispatching an "enterFrame" event each cycle. Then many objects can listen.
This was first used by Robert Penner I believe and is built in to the
Macromedia tween classes. I also have a version if you can't find one
suitable.

To have a smooth animation using setInterval you must call
updateAfterEvent() in the interval, forcing a redraw. Each additional screen
redraw you make is additional processor - the framerate redraw will happen
regardless. The best time to use setInterval is when you want to achieve a
specific interval of time. For example, when the user clicks a scrollbar
arrow it shouldn't move faster and slower based on the framerate a designer
sets the movie at. It will always depends on your context and the behavior
you want.

Tyler



On 5/24/06, Adam Pasztory <[EMAIL PROTECTED]> wrote:


I've found anecdotally the onEnterFrames are less CPU intensive than a
setInterval running at a similar rate.

The cons of setInterval are worth noting, but if you're using a good OOP
code design, and you're strict about tracking your interval IDs, then you
don't have to be too afraid of setInterval.  I usually define a single
member variable in a class to track a particular interval.  Any time I
want
to call set interval, I first make sure the interval is cleared.

...
if(this.intervalId)
   clearInterval(this.intervalId);
this.intervalId = setInterval(this, "someMethod", time);

Seems to work pretty well.

There is also a gotcha related to onEnterFrame that's worth mentioning: A
MovieClip can only have a single onEnterFrame handler, so when you assign
an
event handler to some MovieClip you'd better make sure it doesn't already
have a  different onEnterFrame already assigned to it.  I've run into this
kind of thing when working with animations from artists who like to put a
lot of Actionscript functionality into their MovieClips.

-Adam

On 5/24/06, Rifled Cloaca <[EMAIL PROTECTED]> wrote:
>
> Flashcoders,
>
> I'm building a modular system that contains various programmatic
> animations
> within seperate modules, coordinated by a central wrapper class.  I've
> opted
> to use empty movieclips with onEnterFrame functions to manage timing in
> animations and presentation playback, as opposed to setInterval.  Reason
> being is that I don't want to have to worry about scoping my intervals,
> and
> most of all, losing track of intervals and eventually having them stack
> up,
> interfere with eachother, and cause memory leaks.
>
> Question is, isn't it more processor intensive to use a series of
> onEnterFrames like this?  Can anyone think of any other cons to the
method
> I've chosen?
>
> Thanks in advance!
> -g
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


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

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


Re: [Flashcoders] hitTest vs onRollOver/onRollOut

2006-05-22 Thread Tyler Wright

The main thing that can really add up in processor is the number of
MovieClips at the same level (sharing the same parent). You'll save
processor best if you don't have any on-event events as well, such as
onPress, etc. It's because Flash spends a lot on keeping up with it.

It's really fun to play with ... I had a system that used _droptarget to get
the topmost movieclip and dispatch events up it's parent chain much like AS3
does now. However, the processor was not too friendly, but I know I could do
a lot more viable solution now-days. Let us know how it goes!

Tyler

On 5/22/06, phaedrus <[EMAIL PROTECTED]> wrote:


Thanks a bunch for the info! I'm surprised to hear that the hitTest
actually
performs better, although I agree that the things I may have to add will
more than balance it out.

Basically, I'm trying to grow my own button class which has disabled and
on/off states in addition to rollover and press.  I'd like to be able to
use
hitTests rather than rollover and rolloff because I frequently run into
situations where I want to put a button inside a movie which itself may
have
rollover or rolloff event handlers and the event doesn't reach my button.

I like the hit test approach, but if there was a significant performance
concern, I was going to have to consider another way of going about it.

I've found some AS2.0 classes at
http://www.senocular.com/flash/actionscript.php which may do part of what
I
need.  The main trick now is to figure out how to make a nice packaged
component that allows a designer to modify the look without having to do
too
much work.

I hope to figure out how to deliver them similar to Elvis Mehmedovic's
work
(http://chq.emehmedovic.com/) where all the elements are readily available
in the flash movie for tweaking if necessary.

- phaedrus

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tyler
Wright
Sent: Friday, May 19, 2006 11:02 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] hitTest vs onRollOver/onRollOut

phaedrus,

You will find that, in the beginning, the hitTests will use up less
processor (better performance). The examples you have below, for example.
However, if you program all the logic you'd need to behave exactly as the
other method (keeping track of all the details, etc) you'll quickly begin
to
match the performance and it may end up not being worth the time and bugs
anymore. I still want to build a hitTest solution, mostly for my own
enjoyment, that will at least have equal performance if not better. But it
becomes harder for other developers to work with non-standard inventions,
cool as they may be, and eventually people just get frustrated with your
code.

If it's just for you or you don't plan and building a full mouse-behavior
replacement, try experimenting with _dropTarget ... there's some
possibilities there ;)


good luck,
Tyler


On 5/17/06, phaedrus <[EMAIL PROTECTED]> wrote:
>
> Does anyone know if there is a performance difference between hitTest
and
> onRollOver/onRollOut?
>
> For instance, if I had 100 movie clips on a lower-spec computer, would
> there
> be a notable processing difference between these two approaches:
>
> myMC.onMouseMove = function() {
> if(this.hitTest(_root._xmouse,_root._ymouse,true)) {
> trace("Roll Over");
> } else {
> trace("Roll Out");
> }
> }
>
> Or
>
> myMC.onRollOver = function() {
> trace("Roll Over");
> }
> myMC.onRollOut = function() {
> trace("Roll Out");
> }
>
> I've also got some concerns regarding using _root._xmouse (etc) based on
> the
> comments at:
>
>

http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.ht
> m?href=Part4_ASLR2.html
> but I've not yet looked to deeply into working around it (presumably by
> not
> using _root).  However, if anyone knows that the situation is
> unresolvable,
> that'd be good to know.
>
> - phaedrus


___
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] Local Shared Objects

2006-05-19 Thread Tyler Wright

When opening a SharedObject Flash will use it soley from memory. You can
call Flush to commit the data to disk, but it doesn't reload data from disk.
I think getting a unique reference to the object each time should work, but
only if all other references have been closed. Try deleting a reference as
soon as you've called Flush and are done using it.

good luck!
Tyler

On 5/17/06, Jason Saelhof <[EMAIL PROTECTED]> wrote:


I did try getting a reference to the Shared Object again using...

 myVar = SharedObject.getLocal( ... );

... but it didn't seem to help. I basically set it up so that each time
it tried to read from the object it would get a new reference first.

Jason

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven
Sacks
Sent: Wednesday, May 17, 2006 3:17 PM
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] Local Shared Objects

Did you try setting your variable to the shared object again after the
change?


> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf
> Of Jason Saelhof
> Sent: Wednesday, May 17, 2006 2:00 PM
> To: Flashcoders@chattyfig.figleaf.com
> Subject: [Flashcoders] Local Shared Objects
>
> Hi everyone,
>
>
>
> I'm trying to get a Local Shared Object (LSO) to share data between 2
> flash windows. The first movie creates the LSO and can write
> to it. The
> second movie can then get a reference to the shared object
> and read the
> data set by movie 1. The problem occurs when movie 2 tries to change
> that data and flush it to the disk. Movie 1 doesn't get the
> change. If I
> close movie 1 and re-open it, it can now see the changes.
> This makes me
> think that each instance of the Flash Player is working from
> a "cached"
> copy of the LSO. Can anyone confirm this behavior? Does anyone know a
> way to force the movies to always refer to the disk when
> reading values
> from the LSO?
>
>
>
> Jason.
>
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com

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

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


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

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


Re: [Flashcoders] hitTest vs onRollOver/onRollOut

2006-05-19 Thread Tyler Wright

phaedrus,

You will find that, in the beginning, the hitTests will use up less
processor (better performance). The examples you have below, for example.
However, if you program all the logic you'd need to behave exactly as the
other method (keeping track of all the details, etc) you'll quickly begin to
match the performance and it may end up not being worth the time and bugs
anymore. I still want to build a hitTest solution, mostly for my own
enjoyment, that will at least have equal performance if not better. But it
becomes harder for other developers to work with non-standard inventions,
cool as they may be, and eventually people just get frustrated with your
code.

If it's just for you or you don't plan and building a full mouse-behavior
replacement, try experimenting with _dropTarget ... there's some
possibilities there ;)


good luck,
Tyler


On 5/17/06, phaedrus <[EMAIL PROTECTED]> wrote:


Does anyone know if there is a performance difference between hitTest and
onRollOver/onRollOut?

For instance, if I had 100 movie clips on a lower-spec computer, would
there
be a notable processing difference between these two approaches:

myMC.onMouseMove = function() {
if(this.hitTest(_root._xmouse,_root._ymouse,true)) {
trace("Roll Over");
} else {
trace("Roll Out");
}
}

Or

myMC.onRollOver = function() {
trace("Roll Over");
}
myMC.onRollOut = function() {
trace("Roll Out");
}

I've also got some concerns regarding using _root._xmouse (etc) based on
the
comments at:

http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.ht
m?href=Part4_ASLR2.html
but I've not yet looked to deeply into working around it (presumably by
not
using _root).  However, if anyone knows that the situation is
unresolvable,
that'd be good to know.

- phaedrus



___
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: [Off List Response] for (var i in ..) loop interupted by frame change

2006-05-10 Thread Tyler Wright

It wasn't a targeting issue. Even though the for..i..in loops were being
stopped the frames still changed appropriately. Don't try and make excuses,
it's just a mean thing for Flash to do. ;)

I'm just happy to know the fix.

Tyler

On 5/9/06, Michael Bedar <[EMAIL PROTECTED]> wrote:


If I remeber correctly, goToAndStop() and MoviClip.gotoAndStop() are
completely separate functions, and even have different behavior on
the root timeline.


On May 9, 2006, at 5:47 PM, Tyler Wright wrote:

> This is Great! What a horrible thing to have to know, it just
> doesn't make
> sense that the keyword this would fix it. I can't imagine what
> other scope
> gotoAndStop would effect in this way.
>
> Thanks Elibol. It fixes the problem for both situations, endless
> looping
> for..i..in and the for..i..in's that end prematurely.
>
> "Browser Power for Flash"
> http://www.flashforwardconference.com/sessions?sid=158
>
> Tyler
>
> On 5/9/06, elibol <[EMAIL PROTECTED]> wrote:
>>
>> Hey that's great man! Congratulations, I'm very happy for you =]
>> So what
>> is it you're going to speak about?
>>
>> Weird... Try this:
>>
>>
>> for (var i in list){
>> trace(i);
>> this.gotoAndStop (i);
>> }
>> }
>>
>> Seems that you need to explicity refer to this. I remember there
>> being
>> problems with certain MovieClip functions when they weren't
>> refered to with
>> the this object. I think that in the object stack there might be two
>> definitions of the function and 'this' makes sure that the actual
>> movieclip
>> is the first one that is examined...
>>
>> Extending MovieClips is always full of suprises man...
>>
>> This is interesting, I'm wondering if it's gonna fix your problem
>> though?
>>
>> M
>>
>> On 5/9/06, Tyler Wright <[EMAIL PROTECTED]> wrote:
>>
>> > Hello Elibol!
>> >
>> > I apologize, I mislead you. My EventDispatcher is no longer a
>> problem
>> > and the issue I face now seems to be different. I can only
>> duplicate it
>> > making a component class that extends MovieClip. The issue is
>> that the
>> > for..i..in loop stops after a gotoAndStop.
>> >
>> > class Test extends MovieClip
>> > {
>> > var list:Object;
>> >
>> > function Test()
>> > {
>> > list =
>> > {
>> > one:"one",
>> > two:"two",
>> > three:"three",
>> > four:"four",
>> > five:"five"
>> > };
>> >
>> > for (var i in list)
>> > {
>> > trace(i);
>> > gotoAndStop(list[i]);
>> > }
>> > }
>> >
>> > }
>> >
>> > If you define this class and set it up as a component in the
>> Library you
>> > will see that only "one" is traced out. Then you can comment out
>> the
>> > gotoAndStop(); and it loops through all 5. It behaves the same
>> whether or
>> > not these frames actually exist. I think I'll post this to the
>> list as well,
>> > but thanks for responding so quickly. Did I tell you I got
>> accepted to speak
>> > at FlashForward in September? On Flash and JavaScript.
>> >
>> > Tyler
>> >
>> >
>> > On 5/9/06, elibol <[EMAIL PROTECTED]> wrote:
>> > >
>> > > Nevermind my former message. You can also use the
>> AsBroadcaster class.
>> > > I find it's very solid, however, it doesn't seem to be your
>> problem at all.
>> > >
>> > > If you are coding in frames, and frames with function calls and
>> > > variable definitions are called more than once, then this can
>> mislead your
>> > > assumptions about how many times a piece of code is executed.
>> It might just
>> > > be that you are adding the same object to a broadcaster more
>> than once.
>> > >
>> > > I'm not sure but it seems like this is a possibility. Again
>> though, an
>> > > ends to what you've mentioned on object enumeration, the for
>> in should never
>> > > go into an infinite loop.
>> > >
>> > > M
>> > >
>> >
>> >
>>
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com

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

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


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

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


[Flashcoders] Re: [Off List Response] for (var i in ..) loop interupted by frame change

2006-05-09 Thread Tyler Wright

This is Great! What a horrible thing to have to know, it just doesn't make
sense that the keyword this would fix it. I can't imagine what other scope
gotoAndStop would effect in this way.

Thanks Elibol. It fixes the problem for both situations, endless looping
for..i..in and the for..i..in's that end prematurely.

"Browser Power for Flash"
http://www.flashforwardconference.com/sessions?sid=158

Tyler

On 5/9/06, elibol <[EMAIL PROTECTED]> wrote:


Hey that's great man! Congratulations, I'm very happy for you =] So what
is it you're going to speak about?

Weird... Try this:


for (var i in list){
trace(i);
this.gotoAndStop (i);
}
}

Seems that you need to explicity refer to this. I remember there being
problems with certain MovieClip functions when they weren't refered to with
the this object. I think that in the object stack there might be two
definitions of the function and 'this' makes sure that the actual movieclip
is the first one that is examined...

Extending MovieClips is always full of suprises man...

This is interesting, I'm wondering if it's gonna fix your problem though?

M

On 5/9/06, Tyler Wright <[EMAIL PROTECTED]> wrote:

> Hello Elibol!
>
> I apologize, I mislead you. My EventDispatcher is no longer a problem
> and the issue I face now seems to be different. I can only duplicate it
> making a component class that extends MovieClip. The issue is that the
> for..i..in loop stops after a gotoAndStop.
>
> class Test extends MovieClip
> {
> var list:Object;
>
> function Test()
> {
> list =
> {
> one:"one",
> two:"two",
> three:"three",
> four:"four",
> five:"five"
> };
>
> for (var i in list)
> {
> trace(i);
> gotoAndStop(list[i]);
> }
> }
>
> }
>
> If you define this class and set it up as a component in the Library you
> will see that only "one" is traced out. Then you can comment out the
> gotoAndStop(); and it loops through all 5. It behaves the same whether or
> not these frames actually exist. I think I'll post this to the list as well,
> but thanks for responding so quickly. Did I tell you I got accepted to speak
> at FlashForward in September? On Flash and JavaScript.
>
> Tyler
>
>
> On 5/9/06, elibol <[EMAIL PROTECTED]> wrote:
> >
> > Nevermind my former message. You can also use the AsBroadcaster class.
> > I find it's very solid, however, it doesn't seem to be your problem at all.
> >
> > If you are coding in frames, and frames with function calls and
> > variable definitions are called more than once, then this can mislead your
> > assumptions about how many times a piece of code is executed. It might just
> > be that you are adding the same object to a broadcaster more than once.
> >
> > I'm not sure but it seems like this is a possibility. Again though, an
> > ends to what you've mentioned on object enumeration, the for in should never
> > go into an infinite loop.
> >
> > M
> >
>
>


___
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] for (var i in ..) loop interupted by frame change

2006-05-09 Thread Tyler Wright

I apologize, I mislead you. My EventDispatcher is no longer a problem and
the issue I face now seems to be different. I can only duplicate it making a
component class that extends MovieClip. The issue is that the for..i..in
loop stops after a gotoAndStop.

class Test extends MovieClip
{
   var list:Object;

   function Test()
   {
   list =
   {
   one:"one",
   two:"two",
   three:"three",
   four:"four",
   five:"five"
   };

   for (var i in list)
   {
   trace(i);
   gotoAndStop(list[i]);
   }
   }

}

If you define this class and set it up as a component in the Library you
will see that only "one" is traced out. Then you can comment out the
gotoAndStop(); and it loops through all 5. It behaves the same whether or
not these frames actually exist.

Tyler

On 5/9/06, Thomas Fowler <[EMAIL PROTECTED]> wrote:


I would love to help on this but I need a little more context. From what I
can gather it looks as if you're trying to dispatch an event a series of
events and have the corresponding listener/handler do something? Is that
correct?

As Kevin stated, it would be better to have a class backing these
different
movie clips that dispatch events that trigger another clip to do something
when said events occurs.

On 5/9/06, Kevin Newman <[EMAIL PROTECTED]> wrote:
>
> Logically it seems as though a list of listeners should be in an array,
> instead of a collection of object properties, but to each his own :-)
>
> You seem to have a small typo in here:
>
> for (var i in listeners)
> {
> dispatch(listeners[i].event);
> {
>
> The second curly bracket is backwards. I don't know if that is causing
> your problem though, could you give information?
>
> Also, there is an mx object that can do event
> dispatching/management/delegation:
>
> mx.events.EventDispatcher
>
>
>
http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=2443.html
>
>
> Kevin N.
>
>
> Tyler Wright wrote:
> > I have sevaral for (var i in .. ) loops running looping through
> > objects that
> > get thrown (interupted OR actually go forever) when I change the frame
> > of a
> > movieClip where one exists.
> >
> > Just as an example:
> >
> > for (var i in listeners)
> > {
> >  dispatch(listeners[i].event);
> > {
> >
> > // the listener
> > function setState()
> > {
> >  this.gotoAndStop("over");
> > }
> >
> > or so, produced and endless loop (when the "listeners" object was
> > defined on
> > the movieClip using the for .. i .. in)
> >
> > Anyone have any ideas on fixes? I changed my listener to loop through
> > it as
> > an Array (which isn't as fast and doesn't allow you to remove
listening
> > objects halfway through the process). I've run into a circumstance
> > where I
> > can't use an Array.
> >
> > Tyler
>
>
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


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

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


Re: [Flashcoders] for (var i in ..) loop interupted by frame change

2006-05-09 Thread Tyler Wright

thanks for the quick response.

If you view the source for MM's EventDispatcher you'll see that it traverses
the event listeners array with a for..i..in.  This is so that one of the
listening methods can "removeEventListener" and not screw up the array
mid-process. A for..i..in simply hits every uniqe property despite order or
number.

The code I sent is an illustritive example. I've resolved my
EventDispatcher, but I'm finding this issue is the case in other
circumstanced (states, for example, are changing the frames while a
for..i..in loop is running on that object).

Tyler

On 5/9/06, Kevin Newman <[EMAIL PROTECTED]> wrote:


Logically it seems as though a list of listeners should be in an array,
instead of a collection of object properties, but to each his own :-)

You seem to have a small typo in here:

for (var i in listeners)
{
dispatch(listeners[i].event);
{

The second curly bracket is backwards. I don't know if that is causing
your problem though, could you give information?

Also, there is an mx object that can do event
dispatching/management/delegation:

mx.events.EventDispatcher


http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=2443.html


Kevin N.


Tyler Wright wrote:
> I have sevaral for (var i in .. ) loops running looping through
> objects that
> get thrown (interupted OR actually go forever) when I change the frame
> of a
> movieClip where one exists.
>
> Just as an example:
>
> for (var i in listeners)
> {
>  dispatch(listeners[i].event);
> {
>
> // the listener
> function setState()
> {
>  this.gotoAndStop("over");
> }
>
> or so, produced and endless loop (when the "listeners" object was
> defined on
> the movieClip using the for .. i .. in)
>
> Anyone have any ideas on fixes? I changed my listener to loop through
> it as
> an Array (which isn't as fast and doesn't allow you to remove listening
> objects halfway through the process). I've run into a circumstance
> where I
> can't use an Array.
>
> Tyler


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

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


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

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


[Flashcoders] for (var i in ..) loop interupted by frame change

2006-05-09 Thread Tyler Wright

I have sevaral for (var i in .. ) loops running looping through objects that
get thrown (interupted OR actually go forever) when I change the frame of a
movieClip where one exists.

Just as an example:

for (var i in listeners)
{
 dispatch(listeners[i].event);
{

// the listener
function setState()
{
 this.gotoAndStop("over");
}

or so, produced and endless loop (when the "listeners" object was defined on
the movieClip using the for .. i .. in)

Anyone have any ideas on fixes? I changed my listener to loop through it as
an Array (which isn't as fast and doesn't allow you to remove listening
objects halfway through the process). I've run into a circumstance where I
can't use an Array.

Tyler
___
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] System.as error ?

2006-05-08 Thread Tyler Wright

I've also had this error, several times. It's simply a Flash IDE bug --

Save your work, close and restart Flash, and the error will go away.

Tyler

On 5/8/06, MBDI ICSC Rodrigo E. Curiel Salazar <[EMAIL PROTECTED]> wrote:


I am working on a local drive,

I have some classes, in them I have this:


this.resX = System.capabilities.screenResolutionX;


but I don't think that's the problem, since I remove this line, but I have
the same error


On 5/8/06, Jim Tann <[EMAIL PROTECTED]> wrote:
>
> I have had trouble with this kind of thing when working on a network
> drive. Are you working on one? Can you switch to a local drive?
>
> Jim
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of MBDI
> ICSC Rodrigo E. Curiel Salazar
> Sent: 08 May 2006 11:28
> To: Flashcoders mailing list
> Subject: [Flashcoders] System.as error ?
>
> Hi, I have a issue here, I don't have a clue of what's happening, when I
> test my movie in flash, everything goes well, but if I clear the ASO and
> test the movie, I get the following error:
>
>
> > **Error** C:\...\System.as: Line 5: The name of this class, 'System',
> > conflicts with the name of another class that was loaded.
> >  intrinsic class System {
> >
> > Total ActionScript Errors: 1   Reported Errors: 1
> >
> But, if I remove the System.useCodepage = true; no error is displayed, I
> don't know what to do, any ideas ?
>
> Thanks,
>
> Rodrigo
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
>
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


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

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


Re: [Flashcoders] FDT weirdness

2006-05-05 Thread Tyler Wright

FlashDevelop won't give you any trouble. ;)

I have tried most of the major editors and FDT and FlashDevelop are my
favorite.

FlashDevelop just happens to be free, though I haven't yet seen it do
real-time error checking yet.

Tyler

On 5/5/06, Seb L <[EMAIL PROTECTED]> wrote:


Ah that'll be the one! doh! Thanks Michael.

On 05/05/06, Michael Klishin <[EMAIL PROTECTED]> wrote:
> Seb L wrote:
> > FDT has suddenly stopped doing its code parsing for new classes...
> > anyone else had this? It's still parsing and checking on the
> > pre-existing classes. Weird!
> Check if your classes name starts with uppercase letter. FDT parser
> ignores it otherwise.
>
> --
> Michael "Antares" Klishin,
>
> Blog: http://www.novemberain.com/blog/
> Email: [EMAIL PROTECTED]
>
> Non progredi est regredi
>
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


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

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


Re: [Flashcoders] destructors...

2006-05-04 Thread Tyler Wright

Ian's right.

ActionScript is a dynamic language with its own garbage collection, for
better or for worse. If you try to apply all the same practices and
rulesfrom strict-typed languages that requre manual memory management
you'll go
crazy. The best thing to do is to realize this type of languages strengths
and weaknesses and try to build on them. It's really up to the ActionScript
Virtual Machine now to do ALL memory management, along with your good
practices of making variables local when they can be local and dereferencing
them when you're done using them.

delete myObject;

by itself does not actually destroy myObject. Rather it dereferences the
variable name 'myObject' from the actual data. Later garabage collection
will take care of it if 'myObject' was the last reference to the data. Doing
a delete in this way on a local variable doesn't actually do anything, as
all local variables should clean on their own once their code block
finishes.

Tyler

On 5/3/06, Ian Thomas <[EMAIL PROTECTED]> wrote:


Um - I'm not sure it is beside the point. :-) Given that you are at
the mercy of the garbage collector, implementing a function like:

class MyClass
{
  function cleanup()
  {
delete _someProp;
delete _someOtherProp;
  }
}

is pointless anyway, because if you delete an object of MyClass (or
rather _mark_ it for deletion by calling delete() - that's all
delete() does, and only then if there are no other references to the
class) then its properties are automatically marked for deletion.
Again, unless there are any other references.

The only time I've had to worry about destructors in a
garbage-collected language (such as Flash) is when dealing with
connections to resources - for example, connections to databases, or
closing open socket streams, or releasing handles to video memory
buffers, that sort of thing.

Those sort of things should be pretty rare in Flash... which is why I
asked what you're trying to achieve, because in most cases you can
find a way around it.

If you are dealing with some sort of resource that you want to make
sure shuts down properly when no-one is referring to it, one method is
to explicitly request/release access to the resource and implement
reference counting.

For example, here's a singleton resource class:

class MyResource
{
  private static var _refCount:Number=0;
  private static var _instance:MyResource;

  public function MyResource()
  {
  }

  public static function getResource():MyResource
  {
if (_refCount==0)
{
  _instance=new MyResource();
}
_refCount++;
return _instance;
  }

  public static function freeResource()
  {
_refCount--;
if (refCount==0)
{
  _instance.doCleanup();
  _instance=null;  // You could do delete here if you really wanted
to.
}
  }
}

and then access it like so:

var res:MyResource=MyResource.getResource();

and when you're done
MyResource.freeResource();

But that's really long-winded, and breaks as soon as someone does this:

var res:MyResource=MyResource.getResource();
var res2:MyResource=res; // Took a copy
MyResource.freeResource();

res2.doSomething() // Breaks, because doCleanup() will have been called.

This sort of thing used to crop up quite a lot in C++; which is why
smart pointers and the like were invented.

I can't think of too many situations where you might need that sort of
thing in Flash; which is why I asked what you were trying to
achieve...

Ian


On 5/3/06, Andreas Rønning <[EMAIL PROTECTED]> wrote:
> Kind of besides the point really. The real point is, in my humble
> opinion, that it should be possible to do it without myClass.cleanup();
> delete(myClass);
> It becomes double naughty if your class instance is in an array.
> It's just a question of keeping the amount of fluff down to a minimum.
>
> This is not a critical problem. I am merely asking for people's
> methodologies in self destroying classes.
>
> - A
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


___
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] window.onClose -> Flash

2006-04-30 Thread Tyler Wright

If you're using Flash 8 you can skip using the modal dialog box. Because
ExternalInterface and JavaScript communicate synchronously the JavaScript
waits for Flash to return a value and the window waits for JavaScript. It's
a great setup. You gotta love Flash8!

Tyler

On 4/30/06, g. wygonik <[EMAIL PROTECTED]> wrote:


If you dig in the list archives (if they are still around), i wrote a bit
about how i used onBeforeUnload to trigger Flash and i know other people
chimed in. In IE-only situations, i found it best to catch the
onBeforeUnload event, tell Flash via setVariable, open a modal dialog box
(so the main browser won't close) then either have the modal box close
itself after a few seconds, or have a localConnection or sharedObject
setup
to let a Flash movie in the modal dialog know the main Flash was done and
it
could close itself, which would in turn close the first, main window.
whew!
:-)

There are ways to have a modal box in other browsers, but i don't know the
details off the top of my head.

fwiw
g.

On 4/25/06, erixtekila <[EMAIL PROTECTED]> wrote:
>
>
> Le 25 avr. 06, à 23:31, David Rorex a écrit :
>
> > window.onbeforeunload
> Never knew that one.
>
> I'l check for its availability across platforms. Thanks.
>
> ---
> erixtekila
> http://blog.v-i-a.net/
> ___
> 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
>



--
weblog: broadcast.artificialcolors.com
blazePDF: www.blazepdf.com
band: www.cutratebox.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] Not all MCs get onEnterFrame

2006-04-26 Thread Tyler Wright
> you don't need that, it will be availible because its an anon function
> inside another function, therefore all variables inside the containing
> function will be availible.


 Right, because of this every MovieClip is sharing the same variables --
which is why it behaves unexpectedly.

That worked perfectly.  Thanks, Geoff.
>
>
This is usually the cue that the right answer has been found. Good work
Geoff.

Tyler
___
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] press & hold

2006-04-26 Thread Tyler Wright
enjoy!

Tyler

// modified code snippet from my scroll class

scrollPause = Delegate.create(this, scrollPause);
upArrow.onPress = Delegate.create(this, upArrowPress);
upArrow.onRelease = upArrow.onReleaseOutside = Delegate.create(this,
arrowRelease);

private function scrollUp():Void
{
scrollPosition -= lineScrollSize;
}
private function upArrowPress():Void
{
scrollUp();
scrollInterval = setInterval(scrollPause, 300, scrollUp);
}

// these two methods are shared between arrowUp and arrowDown
private function scrollPause(scrollMethod:Function):Void
{
clearInterval(scrollInterval);
scrollInterval = setInterval(scrollMethod, 30);
}
private function arrowRelease():Void
{
clearInterval(scrollInterval);
}

On 4/25/06, eric dolecki <[EMAIL PROTECTED]> wrote:
>
> What I am currently doing: ( works, just doesn't seem like the right thing
> to do )
>
> var nScrollIntervalMS :Number = 70;
> some_mc.onPress = function(}{
> clearInterval( foobar );
> delete foobar;
> someFunction();
> var nTime = 0;
> // Repeat if held down
> this.onEnterFrame = function(){
> nTime++;
> // Click and Hold detected
> if( nTime > 20 ){
> foobar = setInterval( stationUp, nScrollIntervalMS );
> this.onEnterFrame = null;
> }
> };
> };
> some_mc.onRelease = function(}{
> this.onEnterFrame = null;
> clearInterval( foobar );
> delete foobar;
> }
>
>
> On 4/25/06, Lee McColl-Sylvester <[EMAIL PROTECTED]> wrote:
> >
> > I have one that sets a date onPress and a date onRelease, then compares
> > the date's getTime() to see how long it was pressed.  Works for me,
> > though if you want to set a time during the press, an interval is
> > required.
> >
> > Lee
> >
> >
> >
> >
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of eric
> > dolecki
> > Sent: 25 April 2006 13:55
> > To: Flashcoders mailing list
> > Subject: [Flashcoders] press & hold
> >
> > wondered if anyone had an elegant press & hold function before I wrote
> > one
> > using enterFrame/interval stuff.
> > ___
> > Flashcoders@chattyfig.figleaf.com
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> > ___
> > Flashcoders@chattyfig.figleaf.com
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


Re: [Flashcoders] Flash Layout Manager

2006-04-26 Thread Tyler Wright
Sajid,

I have an AS2.0 class that is a lot simpler to use.

com.codext.managers.LayoutManager.initialize(panel1);
com.codext.managers.LayoutManager.initialize(panel2);

panel1.dock = "top";// this fills the space
panel2.dock = "top";// this fills the space under panel1 and does not
overlap

// and if you want padding

panel1.anchors = {left:50, top:50, right:50};
panel2.anchors = {left:50, top:50, right:50};

you can set anchors without using dock, but then your coordinates are
absolute and are not measured off of their docked siblings.

using these and other Code XT LayoutManager methods you can do about
everything you want where layout is concerned. Resizing is automatic as long
as you're setting the width and height rather than _width and _height.

The only issue is that this is part of a component framework I'm hoping to
release eventually so I don't want it available publically. Maybe we should
talk more about it off list. I would eventually like to get input from users
before the set is released.

Tyler

On 4/26/06, Sajid Saiyed <[EMAIL PROTECTED]> wrote:
>
> Hi Lee,
> Thats a pretty nice component but how do I use it to manage layout?
> I can slace movieclips with it, but didnt quiet get how to rearrange the
> layout.
>
> Hope you can share something on this.
>
> --sajid
>
> On 4/26/06, Lee McColl-Sylvester <[EMAIL PROTECTED]> wrote:
> > Seriously though, I've built something similar.  An admin system for a
> > pageable kiosk app.  It lets you reposition, resize, recolor, format
> > text etc, though the actual adding of items is set in a .NET app.
> >
> > The core functionality behind it is a resizer class I built, which just
> > so happens to be a tutorial component on the macromedia exchange
> > website.  Do a search in exchange for DR-Resizer or Lee McColl and
> > you'll find it.
> >
> > Regards,
> > Lee
> >
> >
> >
> >
> >
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Sajid
> > Saiyed
> > Sent: 26 April 2006 12:04
> > To: flashcoders@chattyfig.figleaf.com
> > Subject: [Flashcoders] Flash Layout Manager
> >
> > I am looking for some hints at creating a layout manager in Flash
> > which will allow me to drag and drop movieclips on stage and at the
> > same time, reposition other movieclips.
> >
> > Something like what you see at www.gtalkr.com
> > ___
> > Flashcoders@chattyfig.figleaf.com
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> > ___
> > Flashcoders@chattyfig.figleaf.com
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
___
Flashcoders@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] PrintJob causes Abort Script error message.

2006-04-03 Thread Tyler Wright
> I have over 20 years of programming experience including at assembler
> level, advanced Java, etc, but thanks for trying to put me in my place :-)


There is no error. There is no timeout. Not in the PrintDialog object.

I think the FlashCoders list in general has a silly habbit of saying
something like:

does mc._xscale = 50 change the width? does anyone know this answer?

and then half a week later, after pages of theoretical discussion, someone
actually tries out the half-minute test.

"Try and do anything advanced (such as a stock exchange trading system) and
it [breaks] ... That ain't an error with my code!"  is a DailyWTF-worthy
comment. What does a stock exchange trading system have to do with the OS
print dialog?

I've never seen this error, in any version of Flash since 7 when it was
created. I've created complex (2-year) systems where the sole product is a
printed page from Flash.

simple test. just a simple test

Tyler
___
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] Wherefore the evils of _global?

2006-03-23 Thread Tyler Wright
On 3/23/06, ryanm <[EMAIL PROTECTED]> wrote:

> Because global variables are contrary to the basis of OOP, which is
> all
> about abstraction and encapsulation. If you need to store variables
> somewhere so that they can be reached anywhere, use a singleton, or a
> static
> class, or an application object, and so on.


Uh, a singleton can be just a round-about method of the global namespace,
but is exactly the same thing (or at least the way I've seen it used with a
__resolve).

_global is a perfect place to store application meta data, the stuff you
might load from an XML file. Such as urls, configurations, etc. However, I
do agree that if you're building anything of significance (in size) you
should have a class (as you mentioned classes are global) that can act as a
singleton or a static; but the trick is it has each property it will hold
defined in it. This way every thing thrown the way of global vars is
documented, type checked, and follows some sort of API. This is easy to
track and debug. That is the hard thing about straight global, finding where
in the world the thing got set or changed when it's being messed up.

 Tyler
___
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] Z sorting multiple overlapping movie clips

2006-03-10 Thread Tyler Wright
:)   uh, a bit of code I've failed to remove.

Taken care of, thanks ... have you used it yet? Is it useful or would there
be any changes I could make to make it more so? I haven't actually had
anyone else use it before so any feedback (good or bad) would be
appreciated.

Tyler

On 3/8/06, eric dolecki <[EMAIL PROTECTED]> wrote:
>
> That class imports:
>
> import xt.core.*;
>
> which is nowhere to be found in the release :/
>
>
>
> On 3/8/06, Tyler Wright <[EMAIL PROTECTED]> wrote:
> >
> > Take a look at the XT DepthManager ( http://codext.com/code/6 ). It
> makes
> > messing with depths like this really simple.
> >
> > Tyler
> >
> >
> > On 3/2/06, Scott Pobiner <[EMAIL PROTECTED]> wrote:
> > >
> > > Karthik, Ramon, and all...
> > >
> > > When doing complex z-sorting ESPECIALLY when using V2 components, you
> > > should use the DepthManager class.  it makes life much easier.
> > > Essentially the DepthManager provides you with functionality for
> > > rearranging depths without explicitly stating the depth numbers...
> > > HOW you ask?!  Well it just so happens that DepthManager comes
> > > complete with a nifty, handy, dandy set of constants (i.e.
> > > DepthManager.kTop)  These constants place your chosen MC on a single
> > > level and consequently shifts all of the prior classes (up or down
> > > depending on the constant used).  BUT THAT'S NOT ALL!!  You also get
> > > free sorting algorithms for moving groups of MC's and components
> > > ABSOLUTELY FREE!
> > >
> > > The thing to keep in mind is that you can't use traditional
> > > "attachMovie" calls to move things to the stage dynamically, nor can
> > > you use items already on the stage with DepthManager.  The reason is
> > > because the DepthManager needs to know what it is sorting at loadtime.
> > >
> > > Here is a snippet example from one of my apps...
> > >
> > >
> > > /**CODE HERE**/
> > > import mx.managers.DepthManager;
> > > /*clipped for brevity*/
> > > // Create a container movie clip.
> > > _tools_mc = target.createChildAtDepth("_tools_mc",
> > > DepthManager.kTop);
> > > //
> > > //create a name label for this users screen
> > >
> > > _name_lbl = target.createClassChildAtDepth(Label,
> > > DepthManager.kBottom, {styleName:"myStyle", color:0xDD, fontSize:
> > > 72});
> > > //_name_lbl = _tools_mc.createClassObject
> > > (Label,"_name_lbl",_tools_mc.getNextHighestDepth(),
> > > {styleName:"myStyle", color:0x33, fontSize:72});
> > > _name_lbl.autoSize = "left";
> > > _name_lbl.text = " ";
> > > _name_lbl.move(55,30);
> > > //
> > > //create _menuBar to show and hide color _dropDown
> > > _menuBar = _tools_mc.createClassChildAtDepth(MenuBar,
> > > DepthManager.kTop);
> > > _menuBar.setSize(Stage.width,_menuBar.height);
> > > /**CODE HERE**/
> > >
> > > Now to move these guys around all I have to do is call the depth
> > > modifiers to change things around...
> > >
> > > # DepthManager.setDepthAbove()
> > > # DepthManager.setDepthBelow()
> > > # DepthManager.setDepthTo()
> > >
> > > see the documentation for more info... http://livedocs.macromedia.com/
> > > flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?
> > > context=LiveDocs_Parts&file=3458.html
> > >
> > > Also, see this chattyfig thread...  http://chattyfig.figleaf.com/
> > > pipermail/flashcoders/2004-May/111796.html
> > >
> > > More info on managers from macromedia...  http://www.macromedia.com/
> > > devnet/flash/articles/component_architecture_06.html
> > >
> > >
> > > Hope this helps..
> > >
> > > S
> > >
> > > > --
> > > >
> > > > Message: 4
> > > > Date: Thu, 2 Mar 2006 11:46:23 +0530
> > > > From: Karthik <[EMAIL PROTECTED]>
> > > > Subject: Re: [Flashcoders] Z sorting multiple overlapping movie
> clips
> > > > To: "Flashcoders mailing list" 
> > > > Message-ID: <

Re: [Flashcoders] Z sorting multiple overlapping movie clips

2006-03-08 Thread Tyler Wright
Take a look at the XT DepthManager ( http://codext.com/code/6 ). It makes
messing with depths like this really simple.

Tyler


On 3/2/06, Scott Pobiner <[EMAIL PROTECTED]> wrote:
>
> Karthik, Ramon, and all...
>
> When doing complex z-sorting ESPECIALLY when using V2 components, you
> should use the DepthManager class.  it makes life much easier.
> Essentially the DepthManager provides you with functionality for
> rearranging depths without explicitly stating the depth numbers...
> HOW you ask?!  Well it just so happens that DepthManager comes
> complete with a nifty, handy, dandy set of constants (i.e.
> DepthManager.kTop)  These constants place your chosen MC on a single
> level and consequently shifts all of the prior classes (up or down
> depending on the constant used).  BUT THAT'S NOT ALL!!  You also get
> free sorting algorithms for moving groups of MC's and components
> ABSOLUTELY FREE!
>
> The thing to keep in mind is that you can't use traditional
> "attachMovie" calls to move things to the stage dynamically, nor can
> you use items already on the stage with DepthManager.  The reason is
> because the DepthManager needs to know what it is sorting at loadtime.
>
> Here is a snippet example from one of my apps...
>
>
> /**CODE HERE**/
> import mx.managers.DepthManager;
> /*clipped for brevity*/
> // Create a container movie clip.
> _tools_mc = target.createChildAtDepth("_tools_mc",
> DepthManager.kTop);
> //
> //create a name label for this users screen
>
> _name_lbl = target.createClassChildAtDepth(Label,
> DepthManager.kBottom, {styleName:"myStyle", color:0xDD, fontSize:
> 72});
> //_name_lbl = _tools_mc.createClassObject
> (Label,"_name_lbl",_tools_mc.getNextHighestDepth(),
> {styleName:"myStyle", color:0x33, fontSize:72});
> _name_lbl.autoSize = "left";
> _name_lbl.text = " ";
> _name_lbl.move(55,30);
> //
> //create _menuBar to show and hide color _dropDown
> _menuBar = _tools_mc.createClassChildAtDepth(MenuBar,
> DepthManager.kTop);
> _menuBar.setSize(Stage.width,_menuBar.height);
> /**CODE HERE**/
>
> Now to move these guys around all I have to do is call the depth
> modifiers to change things around...
>
> # DepthManager.setDepthAbove()
> # DepthManager.setDepthBelow()
> # DepthManager.setDepthTo()
>
> see the documentation for more info... http://livedocs.macromedia.com/
> flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?
> context=LiveDocs_Parts&file=3458.html
>
> Also, see this chattyfig thread...  http://chattyfig.figleaf.com/
> pipermail/flashcoders/2004-May/111796.html
>
> More info on managers from macromedia...  http://www.macromedia.com/
> devnet/flash/articles/component_architecture_06.html
>
>
> Hope this helps..
>
> S
>
> > --
> >
> > Message: 4
> > Date: Thu, 2 Mar 2006 11:46:23 +0530
> > From: Karthik <[EMAIL PROTECTED]>
> > Subject: Re: [Flashcoders] Z sorting multiple overlapping movie clips
> > To: "Flashcoders mailing list" 
> > Message-ID: <[EMAIL PROTECTED]>
> > Content-Type: text/plain; charset=ISO-8859-1
> >
> >> why not mc.swapDepths(getNextHighestDepth() ) ?  Do you have that
> >> many
> >> movieclips?
> >
> > That's what I'm doing.. but without getNextHighestDepth which is (was)
> > buggy when used with v2 components.
> >
> > -K
> >
> >
> > --
> >
> > Message: 5
> > Date: Thu, 2 Mar 2006 14:56:46 +0800
> > From: "Ramon Miguel M. Tayag" <[EMAIL PROTECTED]>
> > Subject: Re: [Flashcoders] Z sorting multiple overlapping movie clips
> > To: "Flashcoders mailing list" 
> > Message-ID:
> >   <[EMAIL PROTECTED]>
> > Content-Type: text/plain; charset=ISO-8859-1
> >
> > mc.swapDepths(getNextHighestDepth() ) works with me.  It puts it
> > above the rest.
> >
> > "Parameters
> >
> > target:Object - This parameter can take one of  two forms:
> > - A Number that specifies the depth level where the movie clip is to
> > be  placed.
> > - A String that specifies the movie clip instance whose depth is
> > swapped with  the movie clip for which the method is being applied.
> > Both movie clips must have  the same parent movie clip."
> >
> > --
> > Ramon Miguel M. Tayag
> > Managing Director
> > Quirkworks
> >
> ___
> 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 

Re: [FlashCoders] textfield swapDepths

2006-03-08 Thread Tyler Wright
I have a DepthManager that will take care of this. It adds the .swapDepths()
method to TextField and Button. More specifically, it replaces the
MovieClip.removeMovie() and TextField.removeTextField() methods so that they
work at whatever depth.

The DepthManager is self-instantiating, but you have to refer to is
somewhere in your code or Flash won't include it when you publish. So
instead of just doing an import (which doesn't force the class to be
included) you can refer to it directly: var dmClass =
xt.core.managers.DepthManager;

These methods aren't dirty, they're just necessary to overcome some of
Flash's shortcommings.
See http://codext.com/code/6

Tyler
___
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] 32bit gradient mask performances

2006-02-09 Thread Tyler Wright
> - draw with draw api a gradient fill in a movieclip (mask_mc),
> 0x00ff to 0x
> - create a new BitmapData (mask_bd) to copy the content of the gradient
> mask
> - draw mask_mc in mask_bd
> - create a new BitmapData (image_bd) to contain the movieclip to be masked
> - draw the movieclip in image_bd
> - create a new BitmapData (picture_bd) to contain the final result
> - copy image_bd to picture_bd using mask_bd as mask


Step one is fine. The rest are completely unnecessary. This is the first
comment on one of Grant Skinners blogs posts (see
http://www.gskinner.com/blog/archives/2005/08/flash_8_alpha_m.html):

Actually FP8 has alpha masks. It's implemented through the bitmap caching
functionality. Try something like this:

mc1.cacheAsBitmap = true;
mc2.cacheAsBitmap = true;
mc1.setMask(mc2);
 *Posted by:* Tinic Uro at August 9, 2005 02:12 PM

The more Bitmap data you're sending around the heavier the processor will
be. CacheAsBitmap will do just fine.

Tyler
___
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 you extend the _y and _height setters of amovie clip?

2006-02-08 Thread Tyler Wright
No, there is no way to do this by extending the MovieClip class.
Unfortunately the _x and _y are unique beasts, along with all the other
MovieClip properties from the Flash 4 days (such as enabled). You can't
watch them, create getters/setters for them, or even over-ride them. You
have to have a getter/setter x and y and inside those set the _x and _y.

If you're feeling creative and absolutely have to have _x and _y as the
properties to watch, then you're class can't be attached to the actual
sprite. You'd have to have a real sprite-based MovieClip referenced inside
the class that you manipulate. I know that probably doesn't make sense, and
it's a programming project you don't want to undertake, with a lot of
potential for problems and failure (I know). You'll have to use the x and y,
which always looks better anyway.

Tyler


On 2/8/06, Scott Hyndman <[EMAIL PROTECTED]> wrote:
>
> You could try watching _y and _height with Object.watch(), and adding the
> extra code in the observing functions.
>
> Scott
>
> -Original Message-
> From:   [EMAIL PROTECTED] on behalf of Morten
> Barklund TBWA\Play
> Sent:   Wed 2/8/2006 11:46 AM
> To: Flashcoders mailing list
> Cc:
> Subject:Re: [Flashcoders] Can you extend the _y and _height
> setters of amovie   clip?
>
> David Lochhead wrote:
> > Hi,
> >
> > I've got a movieclip that can have it's _y and _height properties
> > altered by various scripts. Is there a way I can extend the movieclip
> > class so that the setter for these properties can be extended so I can
> > act when the clip gets updated?
> >
> > Any advice appreciated.
>
> I've tried "extending" the enabled-property without luck. super.enabled
> = my_enabled doesn't really work. It would expect the same from _x and _y.
>
> I do hope someone can give other advice, but until then, I believe it is
> undoable. :(
>
> --
> Morten Barklund - Information Architect - TBWA\Play
> Gothersgade 49, 4th floor - DK-1123 Copenhagen K, Denmark
> Phone: +45 7027 2227 - Fax: +45 3369 1174
> ___
> 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] Secure Site Question

2006-02-07 Thread Tyler Wright
Susan,

Your problem isn't the application accepting the certificate, it's the
browser that has to accept it. Flash embedded in a web page communicates
through the browser. Unfortunately, in some cases where you'd usually get a
warning (such as with Netscape), it silently fails.

The best thing to do until you figure out whats wrong with your certificate
is to have the HTML itself served up from your secure site. This will then
always prompt the user to accept, allowing them to view other content (the
FLV's) from that site.

Tyler

On 2/7/06, Lord, Susan Ms. (CONTR) <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
>
>
> I am new to the list, so I hope this question isn't too basic for you,
> but since I did not receive a response on Flash Newbies,  I figured I
> would try here.
>
>
>
> Here is the problem:
>
>
>
> I linking my flv player to an FLV that is stored on a secure site which
> requires a certificate. The certificate is up to date (not expired), but
> I am still having trouble loading the video.  In Netscape I am prompted
> if I want to accept the cert and it works like a charm. But in IE, I
> don't receive a prompt and it just doesn't run.  Any ideas on what I can
> do to fix this?  Ideally, I would like the application to just accept
> the cert in the background, without prompting the student.
>
>
>
> (I am developing in Flash 8)
>
>
>
> Thanks!
>
> Susan
>
>
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How do you code your Flash applications?

2006-02-07 Thread Tyler Wright
> The range of depths that you can't removeMovieClip() in is between 0 -
> 1048575 ...



excuse me, that you can't removeMovieClip() outside of... if your  MovieClip
is outside of that range, removeMovieClip() doesn't work. Everything else,
however, behaves as normal.

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


Re: [Flashcoders] How do you code your Flash applications?

2006-02-07 Thread Tyler Wright
> app open overnight and used it for several days in a row, they could
> theoretically open enough windows to hit the 65,535 depth limit and
> unexpected things could happen. So I went ahead and wrote the extra 10
> lines
> of code to keep the depths consecutive, and circumvented the problem
> before
> it ever occurred.
>

10 extra lines, but 3 times the processor. For the record, there has never
been a depth limit of 65,535. The range of depths that you can't
removeMovieClip() in is between 0 - 1048575 ... 1048575 being the magic
number that Macromedia uses on the _root for their highest depth. But really
you can still swapDepths() up to 2130690045. I think Flash itself will start
having problems long before your application does.  For the record.

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


Re: [Flashcoders] Re: Setting the last pressed key in the Key class

2006-02-06 Thread Tyler Wright
Define your own static MyKey class and have it subscribe as a listener to
Flash's Key. It can then be your applications "Key" class. Meaning your
objects listen to MyKey while MyKey listens to Key. Then MyKey can at
anytime listen to something else that feeds it input. There's nothing magic
about the Key class you can't use the MyKey class for. MyKey can then also
store the last key pressed (whether it was a real key from the Key class or
a virtual key from somewhere else).

Good luck,
Tyler

On 1/25/06, elibol <[EMAIL PROTECTED]> wrote:
>
> I have another idea, would it be possible to delegate Key class functions
> to
> a custom class I've built?
>
> I've tried
>
> _global.ASSetPropFlags(Key,null,6,true);
>
> It still doesn't allow me to delegate the functions. Does anyone know of a
> way around this?
>
> H
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How do you code your Flash applications?

2006-02-06 Thread Tyler Wright
> Why not pick a good, standardized
> way to manage depths that works in every scenario?


"...tag, you're it!"

Anyway, this has gone on long enough. If you haven't gotten the point
> yet you're never going to.


"...I don't feel like playing anymore."


ok, let's not talk down to others who have good coding practices, even if
they're not your coding practices. It's a good discussion.

Managing the depths the way Ryan does it allows for a lot of control.
getNextHighestDepth can be limiting as you have to predict the appropiate
order of display items which can be problematic in a larger application. But
the manual method sounds even more limiting, labeling depths that not only
are now hard-coded in, but have to be understood and kept track of. I said
it before, order matters, relational depths and not numbers.

This is something that everyone has to deal
> with, and I genuinely thought that others would make more use of
> getNextHighestDepth()


I have my own solution, but everyone else I know of uses getNextHighestDepth.
Those who don't are the proud exception.

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


Re: [Flashcoders] mx.utils.ClassFinder.findClass problem

2006-02-04 Thread Tyler Wright
> Then you can use classfinder to instantiate them dynamically.


I've never seen an mx.utils.ClassFinder ... is it part of the vs. 2
component set they shipped with MX'04 ?

All packages and classes are defined on the _global scope.  Vs. 2 componets'
EventDispatcher, if included in your swf, can be accessed via
_global.mx.events.EventDispatcher.  Seems funny to have a whole ClassFinder
when all you need is

var newClass:Function = eval("_global." + classPath);

which is probably what ClassFinder is anyway.  It's like the MM remoting
componets, a dozen classes to replace the handful of lines of conveniently
undocumented code.  This has nothing to do with this thread, but here's a
freebe for anyone wanting to know how to roll their own remoting.

var nc:NetConnection = new NetConnection();
nc.onStatus = function() { ... };// catch the errors
nc.onResult = function() { ... };// receive the results
nc.connect("http://uri.com/gateway.script";);
if (username != undefined && password != undefined) {
nc.addHeader("Credentials", false, {userid:username,
password:password});
}
// send command to server
nc.call("ClassName.methodName", nc, param1, param2);

it's pretty simple by itself without the complexities of all the proxies
making it simple.

uh, that was a bit of a digression.

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


Re: [Flashcoders] ActionScript equivalent of embed/object BASE tag

2006-02-04 Thread Tyler Wright
In flash you'll have to do your own BASE tag.  You'll either need to prepend
which is probably the best way to go, or do something crazy like

MovieClip.prototype.oldLoadMovie = MovieClip.prototype.loadMovie;
MovieClip.prototype.loadMovie = function(url) {
this.oldLoadMovie("http://prepended.BASE"; + url);
}

However, I strongly recommend you don't do this in real coding that others
might curse you for  ;)

if the baseURL variable doesn't exist, the call will still work. Then, if
> you wanted to, you could pass in the baseURL value through flashvars or
> something, so you wouldnt have to recompile whenever you wanted to change
> it.


Only in Flash 6 ... if you have a Flash 7+ movie you're value will end up "
undefinedmyfile.xml".  It's one of those annoying things you just have to
keep track of.  Just remember to validate your flashvars.

_global.baseURL = (_root.baseurl != undefined) ? _root.baseurl : "";

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


Re: [Flashcoders] How to alter all movieClips with as2

2006-02-04 Thread Tyler Wright
>
> The prototype property is fully accessible in AS2, and because of general
> shortcommings in Flash.
>

uh, it might help to finish my own sentences.  correction:

...and because of general shortcomings in Flash it is sometimes necessary,
even if not recomended.

...continue

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


Re: [Flashcoders] How to alter all movieClips with as2

2006-02-04 Thread Tyler Wright
> ?


hmmm, we all seem to be speaking in short half sentences, or punctuation.

The prototype property is fully accessible in AS2, and because of general
shortcommings in Flash.

(MovieClips, for example, are a cross-breed of the common prototype-based
class and a sprite of magic underscored properties carried over from the ver
beginnings of Flash)

Macromedia uses the prototype for their vs 2 components' DepthManager class:

function DepthManager()
{
MovieClip.prototype.createClassChildAtDepth = createClassChildAtDepth;
MovieClip.prototype.createChildAtDepth = createChildAtDepth;
...
_global.ASSetPropFlags(MovieClip.prototype,
"createClassChildAtDepth",1);
_global.ASSetPropFlags(MovieClip.prototype, "createChildAtDepth",1);
...

I suggest using it sparingly.  Make sure adding it to the prototype is the
only thing that makes sense.  This because it's always hard to track down
bugs added to the prototype when they could have been added from anywhere.

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


Re: [Flashcoders] using MCL to keep track of total bytes loaded.

2006-02-04 Thread Tyler Wright
> No, you will have problems with that implementation.
>

True.  To make it work, just change up a few things:

mainMclListener.onLoadProgress = function( targetMC, loadedBytes,
totalBytes)
{
   // loadedWeight will increment only once per MC, after it is fully
loaded

   // currentLoaded will tell us the loadedWeight from previous SWFs
combined with this ones progress
   var currentLoaded = loadedWeight + loadedBytes;
  // then do a test to find out the percentage currentLoaded is of
totalWeight. i need to know when it's reached 10%, 20%, 30%, etc...
}

mainMcListener.onLoadComplete = function( targetMC )
{
   var progress = mainMcListener.getProgress( targetMC );
   loadedWeight += progress.bytesTotal;
}
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How do you code your Flash applications?

2006-02-04 Thread Tyler Wright
> The whole idea is that you keep
> things at *predictable*, and whenever possible explicitly defined, depths
> so
> that things are easy to manage. If you need getNextHighestDepth, that
> means
> you don't know what the current highest depth being used is, and that
> means
> you aren't in control of the z-depth of your objects. That's a bad thing.


Yes, keep things predictable, and easy to manage.  There are only two
reasons you need control over the z-depth of your display object:

1) to visually layer your objects for appropiate overlapping of the
items relative
to each other.  (usually after you z-position your objects to begin with you
don't touch them again except in the case of floating windows or similar,
which requires a 'put me on top' behavior)

2) to keep from accidently removing a display object through duplicate
depths.

I've also always had to know exactly what depths my display objects were, as
I am generally more of the control friek.  But I realized that I also lay
out a lot of my visual elements in the Flash IDE and never seemed to care
about the actual depth # in that setting.  It was enough to know how
everything was z-ordered the way I wanted in relationship to each other.

I finally made my own DepthManager, which provides for extreme depths for
cursors and tool-tips like MM's vs2 components, but without screwing up
getNextHighestDepth() for those who would still use it. (

API:
MovieClip.bringToFront();
MovieClip.bringForward();
MovieClip.sendBackward();
MovieClip.sendToBack();

where
MovieClip.bringForward();
MovieClip.sendBackward();
can have one parameter, either of type MovieClip or type Number
MovieClip:  brings the calling MC directly in front of the argument MC, or
sends directly behind
Number:  brings or sends calling MC forward or backward x number of steps.
In the case of a 0, bringForward(0) would bring the MC to the front,
sendBackward(0) to the back.  In the case of a negative number,
bringForward(-2) would bring the MC to the front minus two, or 3rd from the
top of the visual stacking order.

this provides for complete control in arranging visual objects in any order,
relative to each other by name and/or by stacking order.

I've never needed to know or care about keeping track of depth numbers
since, though that doesn't mean I don't keep track of z-order (relational).
And frankly I don't have the time or patience anymore to always be managing
depth details when there's so much more to worry about.  I would hate having
all of my classes cluttered with two properties for every one visual object.

private var vScroll:ScrollBar;
private var vScrollDepth:Number;

I'll try and get my code cleaned up a bit (I've been bad and not fully
commented the class) for anyone interested.  It will still allow you to set
depths explicitly, as well as a padding that is currently at 2 or 3, but
could be changed to 10.  To be honest, I haven't yet found an instance where
I've needed the depth number explicitly, but it's available.  This and other
classes that simplify implementation are one of the best ways to keep your
code clean.

Tyler

ps oops, didn't realize I wrote so much.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Naming conventions for AS2.0 ...

2006-02-02 Thread Tyler Wright
I also find that, if you keep your classes appropriately succinct then all
of your variables (and their types) are usually defined within close
proximation to where you use them.  Local variables are a lot more common,
and your class properties should be intuitively descriptive of what they do
in that context.

Properties of the class should also be handled internally, even if they're
accessable externally.  For example, the skin property of a component is
probably a MovieClip, but someone using the component class should use a
styles object to manipulate its appearance.  This of course isn't always
necessary, especially if you want to allow the greatest amount of
flexibility, but if you follow some basic OOP principles it makes special
naming conventions unnescessary.

Good luck with AS2.0, it's a new world even if it's the syntax isn't that
different.

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


Re: [Flashcoders] Javascript + flash

2005-12-27 Thread Tyler Wright
> Is there security issue?



Flash security is a blessing and a curse.  It's often difficult to work
around for developers.  Try setting the allowScriptAccess in both the object
and embed tags to "always" and see if that helps.

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


Re: [Flashcoders] SWF 2 PNG

2005-12-27 Thread Tyler Wright
Easiest solution for me would be to import the swfs into the Flash Authoring
Environment which has an export image option.  It ususally does a decent job
from what I remember.  If you're talking about batching thousands of these
things, perhaps someone has a JSFL script that can tell Flash to do this for
you.  The JSFL is just javascript that gives instructions to the Flash
Authoring Environment to do the same tasks you'd do by hand.  It's been a
lifesaver to me in the past.

Tyler

On 12/26/05, D_C <[EMAIL PROTECTED]> wrote:
>
> hi -
>
> with Flash8 is it possible to screenshot an area of the screen and
> output it to a bitmap file?
>
> If not, would appreciate recommendations for tools that can do this
> automatically, or from command line. i need to create a GIF catalog of a
> whole bunch of SWF files...
>
> /dc
> ___
> 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 IO ?

2005-12-27 Thread Tyler Wright
Reading yes, in ActionScript 3.0 which is currently in public Alpha and
private Beta.  In fact, the new DOM for AS3 offers the same power of
streaming in files that the player uses for SWF's.  So you can ask for a
file, stream in a small portion (whatever you need) close the connection,
and start up again where you left off when you need more!  This is very
exciting for situations that require large amounts of data to be transfered,
the user doesn't have to wait for the whole thing to be able to benefit from
it.

Writing, not without an additional script or application.  If you embed
Flash in a standalone application (exe) it can do the writing for you.
Server side all you need is a simple script that Flash sends the binary data
to that writes it to disk.  For writing Flash forces you to couple with
other technologies.

Prior to AS3 binary handling has been hard to work with and slow.
Everything has to be read into a string and it can get messy with
null-terminating characters.  Hope this helps.

Tyler


On 12/27/05, Mark Ribau <[EMAIL PROTECTED]> wrote:
>
> Is it possible to do either local computer or local website binary file
> reading and writing in Flash?
> --
> Mark Ribau
> Lead Windows Developer | My Tech Blog
> 
> Redbug Technologies, Inc.  - www.redbugtech.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] Who wants MIDI in the Flash Player?

2005-12-15 Thread Tyler Wright
> - Don't include default General Midi Bank (that'd be at least 1-2 MB to
> sound reasonable, so it's out of question, that's like bundling fonts in
> the
> player, pointless)


What is "default General Midi Bank"?  Are you referring to some sort of
additional sound set? I would definately agree do not bloat the player with
a sound font.  However, most soundcards will play MIDI sound straight off of
a MIDI file without the need for any additional software.  If a "simple
MOD/XM engine" were a viable option I'm all for that!



-
> *** MIDI in Flash Player needs to implement Midi  Show Control.
> -


I'd never heard of Show Control before this conversation.  Is it something
that could be light-weight in implementation?  Also, is it something the
common user would use?  If not or if it's specific to a vocation then it
seems it shouldn't be included in the Flash Player, but that an independant
application be built to interface with/through Flash.

I'd argue for implementing MSC and not getting yoo hung up on MIDI sound as
> much.
> Focus on how easily MIDI can enable interoperabilty among the growing
> catalog of so many interestng devices and software.


I feel the opposite.  Though I think interfacing with other various devices
would be very cool, it could add a lot of size to the player for
functionality specific to a particular machine/device setup.  The ubiquity
of the player is in it's universal behavior.  I could go to any computer
anywhere in the world and use an application that plays sheet music
that youbuild, or that customizes a soundtrack to a game as it
progresses.  It would
be great to build for devices and I think it should eventually go that
route, but it's the audio that benefits everyone.

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


Re: [Flashcoders] Who wants MIDI in the Flash Player?

2005-12-14 Thread Tyler Wright
>
> I haven't checked various pocket devices on MIDI recently, but the
> problem on desktops has been when you get varying capabilities on
> various platforms, so that the same MIDI file can sound different on
> different machines.
>
> jd
>
>
I understand that there are various complications, especially when building
a cross platform browser plugin like Flash.  What else do you need from us
to decide if this is a worthy investment?  Some of the developers on this
list could perhaps build a viable solution for you but in the end it has to
be the Flash Player team that makes any sort of commitment.  Maybe in a
seperate forum some of the more experienced developers (I'm not one of them)
could help advise/consult on more in-depth technicalities.

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


Re: [Flashcoders] Who wants MIDI in the Flash Player?

2005-12-14 Thread Tyler Wright
Also, am I incorrect in understanding that many hand-held devices with Flash
Lite already have MIDI available in some form?

I don't know what the implemenations are or what they would mean to the
common OS.  Does anyone have experience with this?
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Who wants MIDI in the Flash Player?

2005-12-14 Thread Tyler Wright
Thank you.

I understand that "Who wants (feature)?" is a very general request.  In this
instance I was probing for feedback on the exact same questions you're
asking, which the developers of Flashcoders gave.

To sum up directly, there were a few areas covered in these conversations:

Developers would like to build MIDI dynamically through low level commands
and then play it.  If it would bloat the filesize of the Flash Player, then
simply add the ability to play a flat MIDI file loaded from a server.  Then
to be dynamic, allow that same loadMidi method to load from an internal
binaryArray as the AS 3 Loader class allows.  Then individual applications
take on the filesize of sequencing MIDI instead of the player itself.  The
last wish which I know very little about is to offer an interface to see the
MIDI devices on the users OS and to connect and communicate with them (with
the users permission, like a webcam).  The Flash Player shouldn't care what
the device is, as long the user is notified.

Developers would also love to have some sort of buffer in which they could
manipulate sound waves directly (binary data in FP8.5) and have it streamed
out to the OS as Flash does with sound files.  Once again, just a
Loaderconcept of playing files from a binaryArray seems like it would
add very
little to the file size.  I don't know the costs of these solutions and I am
just one opinion on this list.  I didn't hear anything on the list about a
simple api or make it easy to handle these powerful abilities.  I personally
would rather see the Player size kept to a minimum, even it it meant I had
to do a lot of custom development in ActionScript.  AS Libraries would be
built to make it available for the common man I'm sure.  But the abilities
have to be there first so users aren't forced to download/install 3rd party
plugins.

Thats my say, for what it's worth.

Tyler

On 12/14/05, John Dowdell <[EMAIL PROTECTED]> wrote:
>
> Tyler Wright wrote:
> > This conversation has now been posted to http://codext.xtyler.com/code/2
> > I've posted a summary along with a direct quote of the entire
> conversation
> > which I hope will continue to receive contributions.  If everyone
> approves,
> > I'll send it off to MM, though I know they also keep up in the
> Flashcoders
> > list and have perhaps already most of this.
>
> Thanks. In the recent rush I haven't been able to read "Who wants MIDI?"
> much less abstract it.
>
> Were you able to get a sense from the whole list of (a) which specific
> MIDI (or MIDI-like) features & implementations are most desired; and (b)
> how much they'd be willing to pay for this in player size?
>
> Do you know what size of MIDI engine would work best for you, for which
> MIDI abilities, for instance?
>
>
> > Anyone also know the link the the MM wish list?
>
> Searching "macromedia wish list" pulls up
> http://www.macromedia.com/go/wish
>
> I know that MIDI or Beatnik or other audio-via-instructions has been on
> the wishlist for awhile, although specific wishes vary in the amount of
> the General MIDI spec they need, and wishes vary in how much of a player
> download effect they'd accept.
>
>
> > I'd like to take a poll. Do you think MIDI should be included
> > in the Flash Player? Why or why not? I want both votes and
> > opinions as I'll organize the results and send them off to
> > "Adobe, formerly known as Macromedia". Please respond with
> > some sort of opinion whether it's pro or con.
>
> Hmm, that sounds sort of mom-and-apple-pie... who would *not* want a new
> ability? The big questions are precisely which abilities under that
> general "midi" label most people actually want most, and what they'd be
> willing to pay for it, in terms of slower audience adoption or greater
> disparity across devices or whatever?
>
> jd
>
>
>
>
> --
> John Dowdell . Adobe Developer Support . San Francisco CA USA
> Weblog: http://weblogs.macromedia.com/jd
> Aggregator: http://weblogs.macromedia.com/mxna
> Technotes: http://www.macromedia.com/support/
> Spam killed my private email -- public record is best, 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] Who wants MIDI in the Flash Player?

2005-12-14 Thread Tyler Wright
I should be the one to thank you guys.

Anyone also know the link the the MM wish list?

Tyler

On 12/13/05, Weyert de Boer <[EMAIL PROTECTED]> wrote:
>
> Yeah, looks nice!
> ___
> 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] Who wants MIDI in the Flash Player?

2005-12-13 Thread Tyler Wright
This conversation has now been posted to http://codext.xtyler.com/code/2

I've posted a summary along with a direct quote of the entire conversation
which I hope will continue to receive contributions.  If everyone approves,
I'll send it off to MM, though I know they also keep up in the Flashcoders
list and have perhaps already most of this.  You've been great!  Here's to
hoping (I could really use these features next spring when 8.5 releases).

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


Re: [Flashcoders] Who wants MIDI in the Flash Player?

2005-12-09 Thread Tyler Wright
I know people who know what they're talking about.  ;)

I've been fortunate enough to work on a project with some amazing developers
and experience the difficulty it is to get Flash to communicate with other
applications.

Thank you everyone for the great response.  I will put together a summary of
this conversation and respond or post it to my blog for your approval.  I
want to make sure it's a fair and unbias (as much as possible)
representation of the developer community before I send it off.

Thanks again!

Tyler

On 12/8/05, hank williams <[EMAIL PROTECTED]> wrote:
>
> Well, its basically what tyler describes but using binary sockets
> instead of xml sockets. The binary socket is just more efficient. I am
> not sure what the issues are in implementing any of this since I am
> not a midi guru, so I cant provide to much detail. Sounds like tyler
> knows what he is talking about.
>
> Regards
> Hank
>
> On 12/8/05, Jason Cunliffe <[EMAIL PROTECTED]> wrote:
> > Hank
> >
> > Can you expand on that idea please. Sounds interesting...
> >
> > thanks, Jason
> >
> > - Original Message -
> > From: "hank williams" <[EMAIL PROTECTED]>
> > To: "Flashcoders mailing list" 
> > Sent: Thursday, December 08, 2005 3:26 PM
> > Subject: Re: [Flashcoders] Who wants MIDI in the Flash Player?
> >
> >
> > Of course, in thinking about this, with the new binary socket
> > functionality, midi control could all be done by just writing a simple
> > localhost to midi gateway. This would be pretty simple to do, and is
> > probably what is needed anyway to deal with different drivers etc. And
> > it makes total sense that if you want to control some local hardware
> > that you need to download a piece of software.
> >
> > problem solved!!  :)
> >
> > Regards
> > Hank
> >
> >
> > ___
> > 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] Who wants MIDI in the Flash Player?

2005-12-08 Thread Tyler Wright
We built a MIDI sequencer for the PC that talks to Flash through an
XMLSocket (though we just send smaller strings, not XML).  On both Mac and
Windows versions the code to make a sequencer capable of changing
instruments, transposing, changing tempo, and indivudual volume of
instruments, etc. was less than 70K.  There are API's for each OS that
abstract the different hardware and allow for such small implementation.

The great thing about Alexis Isaac's MIDI Sequencer is that you can
buildmusic on the fly based on user interaction.  We could have easily
streamed
MP3's from the server with a better sound if we wanted to be static.  We
even looked into building MP3's on the server dynamically, but the smallest
process we could find would be at least 3% processor per song.  That sounds
small, but it means 33 users geting sound simultaneously is 99% processor.
It absolutely has to be on the client.  It would be a great solution to
avoid requiring an additional download from a less-known source than
Macromedia/Adobe and immediately integrate dynamic sound into your
applications.

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


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

2005-12-07 Thread Tyler Wright
It's not going to delete because somewhere else in your code you have a
reference to that object.  For example:

var myObj = new A();

myObj.destory(); // won't be deleted until myObj no longer points to the
class.

If you really have your heart set on following something a little more OOP,
try this.

class A
{
public static var instance:A = new A();

private function A()
{
// construct
}

public function destroy()
{
delete instance;
}
}

a singleton that will destroy it's own reference.  Then the code is within
the class.  The problem now is that you're required to always reference this
class through the static class

A.instance.doSomething();
A.instance.destroy();

Flash is getting better (garbage collection model changes) with AS 3.0, but
for AS 2.0 you're stuck.

Tell me what you want to do in "destroy" and I"ll bet there's a better
solution that is still OOP.  If it's just to delete the object then there's
no reason to have the method.  Sorry.

Tyler

On 12/4/05, Alias <[EMAIL PROTECTED]> wrote:
>
> Hi Boon,
>
> Good luck with learning bytecode.
>
> However, I suspect that the reason your first delete statement doesn't
> work is because of the way flash's garbage collection works. When you
> call delete on an object, it is marked for deletion by the garbage
> collector. It uses reference counting to decide whether to actually
> delete something, so I suspect that if you try to delete an object
> from within itself, it most likely will not actually do so, until that
> object has finished up. I'd say you should probably always try to
> delete objects from outside of their own scope.
>
> It's likely that if this is indeed the case, the problem will look
> exactly the same at the bytecode level.
>
> Hope this sheds some light on your problem,
> Alias
> On 12/3/05, Boon Chew <[EMAIL PROTECTED]> wrote:
> >
> > Is there any tools or documentation out there that
> > will aid in learning actionscript bytecode?
> >
> > I ran into this the other day, and it seems like only
> > reading the bytecode can help me understand why it
> > doesn't work?
> >
> > class A
> > {
> >function destroy()
> >{
> >   delete this;  // doesn't delete itself
> >}
> > }
> >
> > var a = new A();
> > delete a;  // delete works here
> >
> > - boon
> >
> >
> >
> > __
> > Start your day with Yahoo! - Make it your home page!
> > http://www.yahoo.com/r/hs
> > ___
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> ___
> 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] Re: targeting classes in a loaded swf

2005-12-06 Thread Tyler Wright
Cole,

Ha ha, thank you for the compliments.  The good news is you shouldn't have
to use the same agreed upon name.  Thats the great thing about singleton!

for example

main.swf loads in ui.swf

when ui.swf is loaded it has on it's timeline something like:
obj:UI = UI.getInstance();

right?  So now the 'obj' object in ui.swf is the one instance of UI that can
exist (singleton).

so later, when main.swf asks for the same thing:

// calling it 'myUIObj' cause I can
var myUIObj = _global.UI.getInstance();// instance is defined, so we get
the same object that was defined on ui.swf's timeline

it returns the single instance of UI, or ui.swf's 'obj' object.  So test it
by inserting this code

trace(myUIObj == ui_mc.obj);  // returns true -- they are the same instance
of the UI class

This works because your agreed upon point of reference is the class UI.  As
long as you've implemented singleton correctly you can from get that same
object from anywhere.

Note:  This works because AS 2.0 classes are defined on the _global object.
If your class is in a package you'll need to reference it through the
package objects like this:

myUIObj = _global.package.subpackage.UI.getInstance();

also, the reason you use _global.packagename.classname instead of simple
importing the class and referencing it directly is so that Flash doesn't
compile the UI class (and every other class it references) in both swfs.  It
should only be compiled in ui.swf and simple be referenced in main.swf.

I really hope this all makes sense.  If not I know there's some great
articles out there.  Watch the Singleton tutorial by Rob Taylor (
http://www.flashextensions.com) in the Design Patterns section.  It's really
helpful.

Play around with it a bit and see what you get.  Good luck!

Tyler


On 12/4/05, Cole Peterson <[EMAIL PROTECTED]> wrote:
>
>  Thanks a lot for your time Tyler Wright.
>  That helped a lot!
>
> I have implemented your suggestion. singleton. everything is great.
> My controller loads in the swfs that make up the diff parts of the app.
>
> The only disconnect is that all swfs have to agree to implement their ui
> using ...
> for example  the name 'obj'.
>
> var obj:Someclass
> obj = Someclass.getInstance();
> then my controller can target that class in any swf by using the mc that
> it loaded the swf into and calling
>
> mc.obj.getInstance().doSomething();
>
> or just
>
> mc.obj.doSomething();
>
> Does that make sense or am I missing something?
>
> If the above does make oop sense I now have a controller that loads in
> swfs and can then create pointers, if needed, to the main UI object in each
> swf. The only problem I see is forcing the use of an agreed upon name.
>
>
> Thanks again!
> Cole
>
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Who wants MIDI in the Flash Player?

2005-12-06 Thread Tyler Wright
The Flash Player has evolved through the ages to provide the most needed
functionality.  Through each version there have always remained a few common
goals.  What I have found is that:

Flash is small -- from the player itself to the swf file format to the
assets it is optimized to load, focus has been placed on small file sizes
(this of course is not as apparent in many websites that are heavy in
multimedia)

Flash supports standards -- the player supports many web and multimedia
formats standard in the industry, such as jpg, mp3 and xml

Flash is interactive -- the players greatest strength is the dynamic
behavoir through ActionScript to allow user interactivity

MIDI, a music standard format that most computers support today, fits all of
these categories (like a glove).  In fact there's an opensource project
being developed to allow MIDI through Flash, though it requires an
additional download and install to the user apart from the Flash Player
itself (seen at osflash.org)

I'd like to take a poll.  Do you think MIDI should be included in the Flash
Player?  Why or why not?  I want both votes and opinions as I'll organize
the results and send them off to "Adobe, formerly known as
Macromedia".
Please respond with some sort of opinion whether it's pro or con.  I'll list
the pros/cons I can think of below (you don't have to read the rest of this
email if you already have your opinion).

A little more on MIDI:
MIDI is a standard music format (some will argue that it's the
onlystandard) that represents pitches and instruments to be played as
a song.
It's extremely small, being the vector of music, and has to be interpreted
by a users soundcard.  Almost all computers these days support standard
MIDI, though it sounds synthesized (especially on the voice and string
instruments).  Some soundcards or additional software transform the common
MIDI into amazing orchestrations, but most users don't have this advanced
playback.

MIDI pros:
can be generated dynamically and played through a sequencer to allow
complete on-the-fly customization of sound.
very small in filesize
supported by almost all soundcards
numerous applications for the creation of MIDI songs (many are free)
it's a standard that has been around for a long time (so there is a lot of
support for it)
a small implementation (wouldn't increase the Flash Player size by more than
50K)

MIDI cons:
most people will have a more synthesized sound
user experience isn't guarenteed to be consistant (for those with higher
quality soundcards)
as with all advancements, could make it really easy for developers to have
annoying sounds playing on their sites ;)

In short, if the Flash Player had a midi sequencer built in it would allow
developers to create lightweight interactive music applications, such as this
sheet music rendering application  or music
creation applications.  It could also allow users to experience a website
that contained sound effects or decent background music at very little
bandwidth cost.  Formerly know as Macromedia has always been good about
listening to the developer community and will surely make efforts to build
the features we need, if we tell them.  This is your forum.

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


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

2005-12-06 Thread Tyler Wright
mc.onEnterFrame = function() {
trace("hit");
delete this.onEnterFrame;
}

Try this one on for size.  You'll only get one (1) "hit" trace out to the
output window.  If you have actions following the delete they'll still get
called before the method is deleted.

mc.onEnterFrame = function() {
delete this.onEnterFrame;
trace("hit");
}

you still get "hit" traced out once in the output window.

Cicak you're right: "if they have reference counting in place, they can
delete object the moment its ref count is zero"

This is the Flash Player garbage collection right now.  Gary Grossman gave a
great talk at the MAX conference explaining the difference between the
reference counting GC in the current player and the new GC coming in FP 8.5.
Because it's the reference counting system I'm afraid you can't delete an
object this way if there's other references to it.  The reason onEnterFrame
can delete itself is because it's deleting the single reference the system
has to it.

Solution:

since Flash takes care of garbage collection, you don't need special
clean-up procedures (this is why other languages have something like
"destroy")  Forget about OOP usuals and garner the strength provided by a
dynamic language (ie just say "delete myObj;" instead of the OOP required "
myObj.destroy();").

The more I develop the more I find that OOD (object oriented design,
designing your system well) is much more important than OOP (following all
the rules, applicable or not, for the sake of being as much like Java as
possible)

Tyler

On 12/4/05, Hans Wichman <[EMAIL PROTECTED]> wrote:
>
> ps boon, one fast way to verify on windows:
> - repeat your action 10 times in a for lus with the taskmanager open
>
> If the memory you use is being recollected you will see your application
> eat memory and release it, eat it and release it etc if not, it will just
> be hogging memory until it hangs...
> quick and dirty ;)
>
>
> At 02:12 AM 12/4/2005, Boon Chew wrote:
> >Good stuff Steven, I am glad I asked this question (and David's reply is
> >great).
> >
> >   Is there a way to verify that the onLoad is indeed orphaned in the VM
> > memory pool?
> >
> >
> >   - boon
> >
> >
> >Steven Sacks <[EMAIL PROTECTED]> wrote:  Here is something more for you
> >to chew on:
> >
> >If you assign say an onLoad method to an object, and don't delete the
> onLoad
> >before you delete the object, the onLoad method is orphaned and since the
> >reference to the object is gone, it does not get cleaned up by the
> garbage
> >collector, and remains in memory with no way to get to it.
> >
> >For example (AS1 code used here):
> >
> >foo = new XML();
> >foo.onLoad = function(valid) {
> >  if (valid) {
> >   // xml loaded successfully
> >  } else {
> >   // xml load error
> >  }
> >}
> >
> >If you:
> >
> >delete foo;
> >
> >the foo.onLoad method stays in memory.
> >
> >You have to
> >
> >delete foo.onLoad;
> >delete foo;
> >
> >to really get rid of foo.
> >
> >Objects cannot delete themselves, nor can they call another object to
> delete
> >them because technically you're still in the same operation thread.  It
> has
> >to be done independantly outside the object you're trying to delete.
> >
> >The way I get around this is:
> >
> >xmlHolder = {};
> >var id = new Date.getTime();
> >xmlHolder[id] = new XML();
> >xmlHoLDer[id].onLoad = function(valid) {
> >  if (valid) {
> >   // xml loaded successfully
> >  } else {
> >   // xml load error
> >  }
> >  this.complete = true;
> >}
> >
> >I assign a complete = true property.  Then, I have my own little clean up
> >tool running, checking for complete xml loads:
> >
> >for (var o in xmlHolder) {
> >  if(this.xmlHolder[o].complete) {
> >   delete this.xmlHolder[o].onLoad;
> >   delete this.xmlHolder[o];
> >  }
> >}
> >
> >The clean up tool is running in a separate thread therefore it can delete
> >other xmlHolder without issue.
> >
> >HTH,
> >Steven
> >
> >___
> >Flashcoders mailing list
> >Flashcoders@chattyfig.figleaf.com
> >http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> >
> >
> >
> >-
> >  Yahoo! Personals
> >  Skip the bars and set-ups and start using Yahoo! Personals for free
> >___
> >Flashcoders mailing list
> >Flashcoders@chattyfig.figleaf.com
> >http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> ___
> Flashcoders 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] targeting classes in a loaded swf

2005-12-03 Thread Tyler Wright
Of course you want to retain a synchronous relationship (much faster than
LocalConnection).

I'm not sure if this UI object you create is a singleton but the best way to
handle this situation is to use it's class to hold a static pointer to the
instance.

for example

class UI {
private static var instance:UI;
public static function getInstance():UI {
if (instance == undefined) {
instance = new UIController;
}
return instance;
}
}

on frame 1 of the swf: var ui = UI.getInstance();

same thing in your controller: UI.getInstance();

even if it's not a singleton you can use a similar method with only some
minor tweaks.

class UI {
public static var instance:UI;
function UI() {
 if (instance == undefined) {
instance = this;
}
}
}

this way your class will hold a reference to the first instance created, and
you'd still have on your timeline:

var ui = new UI()

This is the perfect way of getting a reference to a major object because now
the instance and class are always shipped together, one nice little
package.  Your AS 2.0 classes are defined on the _global object so everyone
has reference to them, and you're not making some extra (non-oop) reference
floating on the _global object that you can't track where it came from or
who's using it.

hope this helps!

Tyler


On 12/3/05, Mike Britton <[EMAIL PROTECTED]> wrote:
>
> I'd look into LocalConnection.  It sounds like you're trying to figure
> out how to avoid dependencies between objects, which (to me) makes
> sense.  Rather than over-design and make things work in a complicated
> way, you can use LocalConnection to init your child clips from your
> controller:
>
> receiving_lc = new LocalConnection;
>
> receiving_lc.init = function() {
> this.c.init(); // Calls your clip's init
> };
>
> receiving_lc.connect("lc_name");
>
> In your main application:
>
> var sending_lc2:LocalConnection = new LocalConnection();
> sending_lc2.send("lc_name", "init");
>
>
> hth,
>
> Mike
> ___
> 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] Detecting when a swf loses focus

2005-11-23 Thread Tyler Wright
"Basically, the event is onBlur"

Yes, if you've followed the discussion you'd know that onBlur is has been
the attempted solution.  It just doesn't work when Flash has focus ... the
browser seems to miss the onblur if you click on Flash (giving it focus) and
then click outside the window (when the onblur should trigger)

has no one had experience overcoming this?

Tyler

On 11/11/05, Steven Sacks <[EMAIL PROTECTED]> wrote:
>
> There is code out there used to fake modal dialogs in a browser that
> checks
> if a browser window loses focus and forces the window to take focus again.
>
> Really, a google search will help you on your way.  Writing JS isn't too
> difficult if you know AS1.
>
> http://www.eggheadcafe.com/articles/javascript_modal_dialog.asp
>
> Basically, the event is onBlur.
>
> 
>
> function myLoadFocusFunction() {
> -- tell flash something if you want
> -- or handle it directly in the browser
> -- like alert("You have attempted # times to exit the test");
> -- and on the threshold, you can load another page that doesn't
> have
> -- the flash anymore
> }
>
> I'm sure there's an easy solution to what you're trying to do.
>
> -Steven
>
>
>
>
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf
> > Of Tyler Wright
> > Sent: Friday, November 11, 2005 2:47 PM
> > To: Flashcoders mailing list
> > Subject: Re: [Flashcoders] Detecting when a swf loses focus
> >
> > We are looking for a solution to this issue as well. It would
> > be a great
> > help in DRM (Digital Rights Management) to keep not just test
> > takers honest.
> >
> > Anyone yet have a strong enough knowledge of the browser and
> > JavaScript to
> > crack this one?
> >
> > Tyler
> >
> > On 11/8/05, Muzak <[EMAIL PROTECTED]> wrote:
> > >
> > > Mmmm, mind explaining the buggy, unstable and CPU hogging?
> > >
> > > If you have any problems with screenweaver you can always
> > join the mailing
> > > list or visit the forum:
> > > http://osflash.org/mailman/listinfo/screenweaver_osflash.org
> > > http://www.screenweaver.org/forums/index.php
> > >
> > > regards,
> > > Muzak
> > >
> > > - Original Message -
> > > From: "Steven Sacks" <[EMAIL PROTECTED]>
> > > To: "'Flashcoders mailing list'" 
> > > Sent: Tuesday, November 08, 2005 11:00 PM
> > > Subject: RE: [Flashcoders] Detecting when a swf loses focus
> > >
> > >
> > > > Use a 3rd party wrapper like mProjector.
> > > >
> > > > http://www.binarynoise.com/
> > > >
> > > > Way better than the buggy, unstable and CPU hogging Screenweaver.
> > > >
> > > > -Steven
> > >
> > >
> > > ___
> > > 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] Detecting when a swf loses focus

2005-11-11 Thread Tyler Wright
We are looking for a solution to this issue as well. It would be a great
help in DRM (Digital Rights Management) to keep not just test takers honest.

Anyone yet have a strong enough knowledge of the browser and JavaScript to
crack this one?

Tyler

On 11/8/05, Muzak <[EMAIL PROTECTED]> wrote:
>
> Mmmm, mind explaining the buggy, unstable and CPU hogging?
>
> If you have any problems with screenweaver you can always join the mailing
> list or visit the forum:
> http://osflash.org/mailman/listinfo/screenweaver_osflash.org
> http://www.screenweaver.org/forums/index.php
>
> regards,
> Muzak
>
> - Original Message -
> From: "Steven Sacks" <[EMAIL PROTECTED]>
> To: "'Flashcoders mailing list'" 
> Sent: Tuesday, November 08, 2005 11:00 PM
> Subject: RE: [Flashcoders] Detecting when a swf loses focus
>
>
> > Use a 3rd party wrapper like mProjector.
> >
> > http://www.binarynoise.com/
> >
> > Way better than the buggy, unstable and CPU hogging Screenweaver.
> >
> > -Steven
>
>
> ___
> 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