RE: [Flashcoders] Random numbers list

2008-07-29 Thread Jesse Graupmann
I'm sure this isn't needed by now, just thought I'd take it as a fun
challenge.
 

var rangeMin:int = 0;
var rangeMax:int = 100;
var rangeSample:int = 10;


// copy
var numbers:Array = [];

// original values
var numberList:Array = [];
for ( var i:int = 0; i <= (rangeMax - rangeMin); i++ ) numberList[ i ] =
rangeMin + i;


function getRandomArray( len:int ):Array 
{
// reset copy when needed
if ( numbers.length < len ) numbers = [].concat(numberList); 

// transfer random values to new array
var array:Array = [];
for ( var i:int = 0; i < len; i++ ) array [ i ] = numbers.splice(
int( Math.random() * numbers.length), 1 );

return array;
}



for ( i = 0; i < 20; i++ ) trace(  i + ": " + getRandomArray( rangeSample )
);



>>
>> Eduardo Barbosa a écrit :
>>
>>  
>>> Hi all!
>>>
>>>
>>> What I am trying to figure out is this:
>>>
>>> How to generate a sequence of random numbers where the newest is 
>>> always
>>> different from all the previous?
>>>
>>> I need to continuosly rewrite an array of 10 random numbers in 
>>> such a way
>>> that at any given time they are all different.
>>>
>>> Let's say that my range is 0 to 100
>>>
>>> it starts with random numbers, all different:
>>>
>>> {3, 34, 12, 69, 6, 44, 31, 90, 88, 23}
>>>
>>> at a set interval some values are replaced by new ones so there 
>>> are never
>>> two equal numbers, so, after 2 seconds it may look like this:
>>>
>>> {3, 66, 12, 79, 6, 44, 10, 81, 88, 23}
>>>
>>>
>>> Any ideas?
>>>
>>> Thanks :)
>>> Eduardo



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


RE: [Flashcoders] Tweening text more smoothly - AS3

2008-05-24 Thread Jesse Graupmann
@Laurent

So modulus is great and slow from what I've read. I tend to use it in row/
column calculation rather than wrapping a MovieClip position.

var num:int = 6;
var cols:int = 3;

for ( var i:int = 0; i < num; i++ ) 
{
var row:int = Math.floor( i / cols );
var col:int = i % cols;

trace ( "i: " + i + "\trow:" + row + "\tcol:" + col );
}

i: 0row:0   col:0
i: 1row:0   col:1
i: 2row:0   col:2
i: 3row:1   col:0
i: 4row:1   col:1
i: 5row:1   col:2


In the previous post I'm moving a MovieClip to the right X.X pixels and when
its position is off the screen I reset it back to 0. If I used the modulus
method, the movement would always be rounded numbers and appear jerkier than
this experiment requires. I'm actually hoping to round to the nearest twip.


As for the examples themselves


#1
onT is a timer tick. So about every 30ms it will move the MovieClip X pixels
based on speed. Because Timers are never accurate to what you expect ( they
only get as close as they can - see below ) onT will always be dragging
behind the other two methods and moving at varied speeds. 


//  Elapsed time from a tick on var t:Timer = new Timer(30);

47,38,36,36,36,36,36,38,36,35,35,36,36,34,36,42,36,35,35,36,35,37,40,36,36,3
6,36,36,54,36,37,35,34,36,38,38,36,36,36,36,69,39,35,36,35,36,36,42,44,36,36
,35,36,35,63,37,33,36,35,37,40,30,35,34,36,92,55,66,35,36,34,36,46,36,36,36,
36,97,50,34,35,35,36,36,34,33,218,142,49,121,59,110,84,102,65,106,66,58,55,6
5,34,36,35,36,64,33,35,36,35,37,31,48,34,36,35,35,36,77,34,34,36,36,36,70,36
,35,37,35,37,74,54,35,36,71,65,35,36,36,35,35,73,37,36,36,34,43,66,35,38,36,
35,34,73,36,34,50,59,67,37,36,36,36,56,47,37,36,36,34,36,30,46,35,36,36,36,5
9,46,35,36,36,36,59,45,35,36,36,34,36,32,48,37,37,35,38,56,48,34,36,36,36,58
,47,34,37,36,36,57,72,45,36,50,55,45,35,35,35,36,61,45,36,35,35,36,66,45,131
,39,45,33,37,34,37,34,45,51,36,51,49,38,67,35,36,36,34,43,47,38,50,35,34

//  Difference from expected 30ms

17,8,6,6,6,6,6,8,6,5,5,6,6,4,6,12,6,5,5,6,5,7,10,6,6,6,6,6,24,6,7,5,4,6,8,8,
6,6,6,6,39,9,5,6,5,6,6,12,14,6,6,5,6,5,33,7,3,6,5,7,10,0,5,4,6,62,25,36,5,6,
4,6,16,6,6,6,6,67,20,4,5,5,6,6,4,3,188,112,19,91,29,80,54,72,35,76,36,28,25,
35,4,6,5,6,34,3,5,6,5,7,1,18,4,6,5,5,6,47,4,4,6,6,6,40,6,5,7,5,7,44,24,5,6,4
1,35,5,6,6,5,5,43,7,6,6,4,13,36,5,8,6,5,4,43,6,4,20,29,37,7,6,6,6,26,17,7,6,
6,4,6,0,16,5,6,6,6,29,16,5,6,6,6,29,15,5,6,6,4,6,2,18,7,7,5,8,26,18,4,6,6,6,
28,17,4,7,6,6,27,42,15,6,20,25,15,5,5,5,6,31,15,6,5,5,6,36,15,101,9,15,3,7,4
,7,4,15,21,6,21,19,8,37,5,6,6,4,13,17,8,20,5,4


#2
onT2 - To compensate for the difference, I decide that for every 30ms that
have passed the MovieClip should increment the correct amount ( 1 pixel ).
When the tick occurs, I subtract the stored time (lastTick2) from the
current time giving me the most accurate elapsed time. Dividing by the tick
time gives me a percentage of my expected elapsed time. Multiplying that
value by the speed produces the most accurate change over time.

#3
onT3 - Because I can assume speed based on elapsed time is the most
accurate, it won't matter when I call the function as long as it happens
once per frame. So onT3 just uses the ENTER_FRAME event to calculate speed
based on elapsed time using lastTick3.

Here is another example that is commented a bit better and should make all
this very apparent.

stage.align = "TL";
stage.scaleMode = "noScale";
stage.addEventListener ( Event.ENTER_FRAME, onFrame );

//  for every (stepTime)ms move (stepRate)pixels
var stepTime:int = 30; 
var stepRate:int = 1;
var time:int = getTimer();

function onFrame ( e:Event ):void 
{
//  time since last frame
var elapsedTime:int = getTimer() - time;

//  store current time for the next check
time = getTimer();

//  percentage of expected time
var timePercentage:Number = elapsedTime / stepTime;

//  rate compensation
var movement:Number = timePercentage * stepRate;

//  move mc
mc.x += movement;

//  wrap if off the stage
if ( mc.x > stage.stageWidth ) mc.x = 0;
}


Hasta!
Jesse


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of laurent
Sent: Saturday, May 24, 2008 2:13 AM
To: Flash Coders List
Subject: Re: [Flashcoders] Tweening text more smoothly - AS3


:) I just read about wraping using modulus on Grant Skinner's blog:

sprite.x = (sprite.x + 5) % stage.stageWidth;

And then get where was that checkWrap methods :]
Still I'm interested in the onT methods...I don't think I will get them
before Grant's next post.

the article about using modulus:
http://www.gskinner.com/blog/archives/2008/05/core_as3_modulu.html

 L

Jesse Graupmann a écrit :
> Maybe converting the actual time elapsed to a consta

RE: [Flashcoders] Tweening text more smoothly - AS3

2008-05-24 Thread Jesse Graupmann

Maybe converting the actual time elapsed to a constant rate of motion could
help... who knows?


stage.align = "TL";
stage.scaleMode = "noScale";

function checkWrap ( o:DisplayObject ):void
{
if ( o.x > stage.stageWidth ) o.x = 0;
}

var speed:Number = 1;
var tick:Number = 30;
var lastTick2:Number = getTimer();
var lastTick3:Number = getTimer();
var t:Timer = new Timer(tick);
var t2:Timer = new Timer(tick);

t.addEventListener( TimerEvent.TIMER, onT );
t2.addEventListener( TimerEvent.TIMER, onT2 );
stage.addEventListener( Event.ENTER_FRAME, onT3 );
t.start();
t2.start();


function onT( e:TimerEvent ):void
{
//  timer
mc.x += speed;
checkWrap ( mc );
}


function onT2( e:TimerEvent ):void
{
//  timer + speed
mc2.x += (( getTimer() - lastTick2 ) / tick ) * speed;
lastTick2 = getTimer();
checkWrap ( mc2 );
}


function onT3( e:Event ):void
{
//  enter frame + speed
mc3.x += (( getTimer() - lastTick3 ) / tick ) * speed;
lastTick3 = getTimer();
checkWrap ( mc3 );
}


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of jonathan
howe
Sent: Friday, May 23, 2008 3:53 AM
To: Flash Coders List
Subject: Re: [Flashcoders] Tweening text more smoothly - AS3

Apologies if this has already been mentioned... I discarded some of the
original posts.

If you are using a timer with a delay that does divide evenly to your frame
rate, it stands to reason that some screen updates the item will have
traveled more pixels than others.

Example: Frame rate 24 fps roughly equals .042  updates per second:

Frame 1 (.000) : Timer fires at .02, .04
Frame 2 (.042) : Timer fires at .06, .08
...
Frame 10 (.380) : Timer fires at .38, .40, .42
Frame 11 (.422) : Timer fires at .44, .46

So in this example, every ten frames/screen updates you're jumping an extra
pixel. Therefore either keeping framelength % updatedelay = 0, or forcing
screen update with updateAfterEvent() might solve the problem.

Again, sorry if someone already mentioned this.

-jonathan


On Fri, May 23, 2008 at 5:59 AM, EECOLOR <[EMAIL PROTECTED]> wrote:

> You could create a bitmap using BitmapData.draw. Add that to your display
> list, set cacheAsBitmap to true and things should run smootly.
>
> Not sure if it works, but it is just another suggestion.
>
>
> Greetz Erik
>
> On 5/22/08, Vayu Robins <[EMAIL PROTECTED]> wrote:
> >
> > Hej.
> >
> > I am wondering if there is anything that could be done to improve the
> > panning/scrolling/tweening of the news items at the bottom of the this
> > page:
> >
> > http://flashkompagniet.dk/flash/main.php
> >
> > I am running a timer at 20 milliseconds Timer(20, 0);
> >
> > And the news items are being moved a 1px everytime the timer event is
> > dispatched.
> >
> > I dont think they are runnning very smoothly.  Is that just me or does
> > anyone else see that too.
> >
> > Can anything be done?
> >
> > Thanks
> > Vayu
> >
> >
> > ___
> > 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
>



-- 
-jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
___
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] very easy question

2008-05-21 Thread Jesse Graupmann
http://www.kirupa.com/forum/showthread.php?p=1910480

Jonathan mentioned this before... you're goal isn't to set your text to
display what the loader is. Your goal is to display the content that is
loaded. In order to do that, you need to listen to the load event and get
the data out of there.

loader.addEventListener(Event.COMPLETE, stuffLoaded);
function stuffLoaded(event:Event):void 
{
var myStuff = loader.data;
//...
}


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gustavo
Duenas
Sent: Tuesday, May 20, 2008 1:09 PM
To: Flash Coders List
Subject: Re: [Flashcoders] very easy question

ok, when I trace this instead of the text it shows [target.object]
it is a html xml formatted page, it is supposed to show in other way  
right?


regards,

guatvo
On May 20, 2008, at 3:48 PM, Eduardo Omine wrote:

> Try this:
>
> var loader:URLLoader = new URLLoader();
> loader.load(new
> URLRequest("http://leftandrightsolutions.com/txt/whoweare.txt";));
>
> -- 
> Eduardo Omine
> http://blog.omine.net/
> http://www.omine.net/
> ___
> 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] URLLoader Class and some thinking

2008-04-28 Thread Jesse Graupmann
An alternate version...

QueueLoader
http://code.google.com/p/queueloader-as3/
http://blog.hydrotik.com/category/queueloader/ 


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Patrick
Jakub Jankun
Sent: Monday, April 28, 2008 1:10 AM
To: Flash Coders List
Subject: Re: [Flashcoders] URLLoader Class and some thinking

Thanks Andrei!

Seems to be execlty what I was looking for :)


On 4/28/08 12:08 AM, "Andrei Thomaz" <[EMAIL PROTECTED]> wrote:

> maybe this helps you:
> http://code.google.com/p/bulk-loader/ 
> 
> []'s
> andrei
> 


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


RE: [Flashcoders] transition

2008-03-14 Thread Jesse Graupmann
http://www.websector.de/blog/2007/08/28/tweener-as3-extension-for-color-prop
erties-_brightness-_contrast-and-_saturation/


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of marcellouz
Sent: Friday, March 14, 2008 6:21 AM
To: Flash Coders List
Subject: [Flashcoders] transition

hi all,

anyone out there who knows how to manage this type of picture transition
effect?

http://www.schierke.com/

thx,
marcel

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


RE: [Flashcoders] clean scripting

2008-03-12 Thread Jesse Graupmann
Sorry for being away for awhile and just testing that out now. So yea...
WTF? I can't believe after my years of AS2 coding that it would have taken
me this long to notice.
 
Well, good thing for AS3.


//  NOT SHARED

public var myArray:Array;

public function MyClass() {
myArray = [];
}

//  SHARED

public var myArray:Array = new Array();

public function MyClass() {
}


Cheers,
Jesse


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Wednesday, March 12, 2008 2:04 AM
To: Flash Coders List
Subject: Re: [Flashcoders] clean scripting

In AS2 it does (and has been discussed here in the past), in AS3 it doesn't.

- Original Message - 
From: "Jesse Graupmann" <[EMAIL PROTECTED]>
To: "'Flash Coders List'" 
Sent: Wednesday, March 12, 2008 5:38 AM
Subject: RE: [Flashcoders] clean scripting


> Muzak,
> 
> Maybe I missed something, but instance2 in your example has no data. Only
> static members can be shared across all instances - did you mean...
> 
> 
> class MyClass
> {
> 
> private static var myArray:Array = new Array();
> 
> public function addItem(item:Object)
> {
>MyClass.myArray.push(item);
> }
> 
> public function get data():Array 
> {
>return MyClass.myArray;
> }
> 
> }
> 
> 
> regards,
> Jesse

___
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] clean scripting

2008-03-11 Thread Jesse Graupmann
I agree with Steven. You may want to put your variable declarations in
another function when they either get suuuper messy or you need more data
(ie. stage.stageWidth).

Going back to style... typically I like to run an INIT() in the constructor
and then break down the tasks into INIT_name(). It cleans up the top pretty
well and makes the code very easy to read/understand.


package
{
import flash.display.Sprite;
import flash.events.MouseEvent;

public class MyClass extends Sprite
{
public static var prop:Number = 0;
public var solid:Sprite;

public function MyClass() 
{
INIT();
}


//  ___
EVENTS


private function click ( e:MouseEvent ):void 
{
//...
}


//  ___
INITIALIZE  

private function INIT ():void
{
INIT_clips();
INIT_vars();
}

private function INIT_clips ():void
{
solid.addEventListener ( MouseEvent.CLICK,
click );
}

private function INIT_vars ():void
{
// ...
}
}
}

2 more cents,
Jesse


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks
Sent: Tuesday, March 11, 2008 6:49 PM
To: Flash Coders List
Subject: Re: [Flashcoders] clean scripting

I'm going to chime in here.

Lazy Instantiation is an irrelevant argument when you're instantiating 
in the constructor.  What you perceive as "cleaner" is merely philosophical.

var container:Sprite = new Sprite();

vs

var container:Sprite;

public function ClassName()
{
container = new Sprite();
}

I think the single line version is cleaner.  In fact, I would argue that 
instantiating classes in their variable declaration is a very specific 
way of making it extremely clear that those variables are being made 
available immediately to the class, and anything that does not have a 
definition is going to be lazily instantiated later.

I'm a big fan of this type of coding practice where the meaning is 
derived from the style.

My 2 cents,
Steven

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


RE: [Flashcoders] clean scripting

2008-03-11 Thread Jesse Graupmann
Muzak,

Maybe I missed something, but instance2 in your example has no data. Only
static members can be shared across all instances - did you mean...

 
class MyClass
{
 
 private static var myArray:Array = new Array();
 
 public function addItem(item:Object)
 {
MyClass.myArray.push(item);
 }
 
 public function get data():Array 
 {
return MyClass.myArray;
 }
 
}


regards,
Jesse


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Tuesday, March 11, 2008 4:51 PM
To: Flash Coders List
Subject: Re: [Flashcoders] clean scripting

Allthough the following no longer seems to apply in AS3, it might be good to
know.

In AS2, if you have the following class:

class MyClass {
 
 private var myArray:Array = new Array();
 
 public function addItem(item:Object) {
  myArray.push(item);
 }
 
 public function get data():Array {
  return myArray;
 }
 
}

The myArray class member will be shared across ALL instances of the class.

var instance1:MyClass = new MyClass();
var instance2:MyClass = new MyClass();

instance1.addItem("Hello World");
trace(instance1.data);
trace(instance2.data);

//output:
Hello World
Hello World

regards,
Muzak

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

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


RE: [Flashcoders] [AS3] optional parameters - sansdefaults for Boolean/Number/int

2008-02-29 Thread Jesse Graupmann
Ha! That works just fine.

Thanks for reminding me Glen.



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Glen Pike
Sent: Friday, February 29, 2008 2:49 AM
To: Flash Coders List
Subject: Re: [Flashcoders] [AS3] optional parameters - sansdefaults for
Boolean/Number/int

Hi,

You can have * to specify any parameter:

function myFunc(param1:Boolean, param2:*);

Matthew Houliston wrote:
> don't you mean
>
> function test2 ( a:Boolean = false )
> {
> trace( "a: " + ( a == true ) );
> }
>
> ?
>
>
> A Boolean is never null.
>
> var b:Boolean;
> trace(b);

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


[Flashcoders] [AS3] optional parameters - sans defaults for Boolean/Number/int

2008-02-29 Thread Jesse Graupmann
I'm trying to create typed functions using optional parameters sans the
defaults. I'm finding String to be the only thing that allows for null to be
passed. Is there a way to extend that functionality to other types like;
Numbers, Booleans, and/or ints?

NOTE : I am aware of ...rest and passing an object like what's used in
Tweener but that hides too much.


Thanks in advance,
Jesse



//  EXPECTED


function test ( a:String = null ) 
{
trace( "test: " + ( a == null ) );
}

test ( "test" ); // false
test ( ); // true <--- GOOD




//  UNFORTUNATE


function test2 ( a:Boolean = false ) 
{
trace( "a: " + ( a == null ) );
}
test2 ( true ); // false
test2 ( false ); // false
test2 ( ); // false <--- BAD



//  IDEAL


function test4 ( b:Boolean = null )
{
trace( b==null );
}

function test5 ( n:Number = null )
{
trace( isNaN(n) );
}

function test6 ( i:int = null ) 
{
trace( isNaN(i) );
}

test4 ( ); // true <--- DESIRED
test5 ( ); // true <--- DESIRED
test6 ( ); // true <--- DESIRED



//  CURRENT WORK AROUND -- ONLY WORKS WHEN NEEDING POSITIVES


function test7 ( w:Number = -1, h:Number = -1 ) 
{
trace( (w < 0 || h < 0) );
}

test7 (10, 10); // false
test7 (10); // true
test7 (); // true

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


RE: [Flashcoders] Graphic design universities

2008-02-25 Thread Jesse Graupmann
I've had friends attend;

Vancouver Film School
http://www.vfs.com/

Western Washington
http://www.ac.wwu.edu/~artdept/degreesdetail.html#Bachelor%20of%20Arts%20Des
ign

and 

Art Institute of Seattle
http://www.artinstituteseattle.com/programs.php


Whereas I went to;

University of Washington
http://depts.washington.edu/designuw/VCD_overview.htm


While you could apply your current skills to each, you should think more
about what you want to get out of your education. Courses that teach you how
to use programs will be the fastest way to learning production skills.
Theory based courses won't teach you how to use anything, but will give you
a more knowledge of problem solving and process.

The thing that helped me decide which school to choose was actually visiting
the places I wanted to work post graduation. Asking them which universities
produced the quality they were looking for help narrow down the list.

Good luck in your search,
J|G


>> Hi list.
>>
>> I have two years to choose in which univerity i'll go when my
>> school
 studies
>> finish. I am looking for some graphical design universitys in
>> which i
 can
>> apply my knowledge offlash, animation, video and audio modeling.
>> So,
 mostly
>> about graphics and motion. I've been googling the web, but i  
>> found
>> so
 many
>> results that my head went bad,and they mostly all of them had  
>> some
 other
>> studies that i don't like such as ecomony, telecommunication
>> between
 others.
>>
>>
>> So, can someone recommend me some universites you think are good?
>>
>> Thanks
>>
>> Pedro D.K.

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


RE: [Flashcoders] variable with # sign

2008-02-21 Thread Jesse Graupmann
How are you "passing" the variable to an email form? You typically never
NEED to create a funky variable name if creative string solutions could do
the job. How about something like "f_31" until you have to package it up to
send? And how does the end process know the variable name?

var str:String = "f#31";
this [ str.split("#").join("_") ] = "test";
trace( this.f_31 ) // test

- J

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Martin
Klasson
Sent: Thursday, February 21, 2008 12:50 AM
To: Flash Coders List
Subject: Re: [Flashcoders] variable with # sign

this[f#31] = "TEXT:Email%20Address";

This could work for you I guess, it wont give you a compiler error,
but I would revise the code since I wouldnt suggest this "ugly" solution.

If you could show more code on how you are sending the data,
as well as what Flash Player version you are targeting there would
easier to give you a more helpful hand if you want the solution to
be more legit than the solution above.

/ Martin


2008/2/21, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
> Hi.
> I need to pass a variable to a email sign-up form and it needs to be
> named f#31
>
> I have it written:
>
> var f#31 = "TEXT:Email%20Address";
>
> Flash gives me an error when I try to publish this and I assume its
> because the variable name has the # sign. How do I get around this?
> I've tried escape sequences to no avail.
>
> Thanks!
> -Alex
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 

Martin Klasson
Flash Developer
Parkgatan 9-11
S-411 24 Göteborg
Sweden
Office +46 (0) 31 711 54 50
Cell +46 (0) 730 964 561
[EMAIL PROTECTED]
www.kokokaka.com
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


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


RE: [Flashcoders] How did they do it?? A particular flash site.

2008-02-08 Thread Jesse Graupmann
Thanks Adrian, I couldn't have said it better. Sorry for the confusion
folks. 


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adrian Park
Sent: Friday, February 08, 2008 6:16 AM
To: Flash Coders List
Subject: Re: [Flashcoders] How did they do it?? A particular flash site.

Hi Peter,
I understood Jesse's comment to be a follow on to his sarcastic reference to
'magic' and he is in fact insinuating that it's simpler than it looks and
therefore, yes, anyone interested enough can learn how to do it. I don't
think he meant any offense.

If I'm not mistaken he's alluding to the fact that this site is an example
of where the individual parts are actual pretty simple but, put together as
they have been, the finished piece appears to be greater than the sum of
those parts - like magic.

Adrian


On Feb 8, 2008 2:06 PM, Dave Mennenoh <[EMAIL PROTECTED]> wrote:

> >>I remember someone saying that the developper told him that:
> *Scenes were rendered using Maya*
>
> That was me. I emailed them and asked. Yeah it's very well done, no doubt.
>
>
>
> Dave -
> Head Developer
> http://www.blurredistinction.com
> Adobe Community Expert
> http://www.adobe.com/communities/experts/

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


RE: [Flashcoders] How did they do it?? A particular flash site.

2008-02-07 Thread Jesse Graupmann
With magic! 

Unfortunately if you haven't learned it by now you'll never be able to
understand its full potential.


Full screen - FLASH and HTML
http://www.kirupa.com/developer/mx2004/fullscreen.htm
http://gotoandlearn.com/player.php?id=31

CSS
http://www.kirupa.com/developer/mx2004/css.htm

VIDEO
http://gotoandlearn.com/player.php?id=46
http://gotoandlearn.com/player.php?id=1 

TRANSPARENT VIDEO
http://www.pjenkins.co.uk/blog/index.php/2006/09/22/transparent-flash-video-
for-a-website/#more-3



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Vlado Krempl
Sent: Thursday, February 07, 2008 3:19 PM
To: Flash Coders List
Subject: [Flashcoders] How did they do it?? A particular flash site.

Hello everyone,

There is a great flash site that I absolutely love, and just wanted your
opinion on how they layed it out.

The site is :
 http://checklandkindleysides.com

They use a background gradient image, so is the flash movie in transparent
mode?? 
Or perhaps they have used another program for 3D, for example I read
somewhere that Swift 3D is great for this kind of work.
They also use CSS on the nav text, have they integrated html with flash??

Cheers,

Vlado  

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


RE: [Flashcoders] Yes or no: Moving one MC into another (AS2)

2008-02-07 Thread Jesse Graupmann
Yup. 

It's never too late to make the switch to AS3. You'll also sleep better at
night if you do.

;)

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mendelsohn,
Michael
Sent: Thursday, February 07, 2008 11:14 AM
To: Flash Coders List
Subject: RE: [Flashcoders] Yes or no: Moving one MC into another (AS2)

That would do it, Bob, thanks, but my clips aren't even in the library.
(It's all generated by code.)  

I'm wondering, isn't this issue solved in AS3 with addChild()?

- MM




I'm not sure at what point in your runtime you want to make the copy, 
but if these clips are all library symbols in the same fla and are 
exported for Actionscript, wouldn't this do it?

B.attachMovie("A", "myA", B.getNextHighestDepth());
B.myA.attachMovie("X", "myX", B.myA.getNextHighestDepth());


___
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] Max MovieClip Size Before Filters are Dropped?

2008-02-07 Thread Jesse Graupmann
Mark,


A quick way around that is to use the scrollRect property. While it'll cause
some new annoying issues, it'll be the best fix for the size problem.


image.scrollRect = new Rectangle ( 0, 0, 100, 100 );


AS 3
http://www.gskinner.com/blog/archives/2006/11/understanding_d.html 

AS 2
http://www.sephiroth.it/tutorials/flashPHP/scrollRect/




_____

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Zeh Fernando
Sent: Thursday, February 07, 2008 11:29 AM
To: Flash Coders List
Subject: Re: [Flashcoders] Max MovieClip Size Before Filters are Dropped?

2880 pixels on any dimension. It's mentioned somewhere in the documentation.

Mark Hawley wrote:
> Anyone know the maximum size, in pixels, a MovieClip can be before Flash
> refuses to apply filters to it? It seems to be dependent on the filter
> parameters, making me think there's a max size on the rendered clip.
> ___
> 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] copy mask from one clip to another

2008-02-07 Thread Jesse Graupmann

1. Create empty MovieClip ( clipC ) on same parent as clipB
2. Create BitmapData from clipA
3. Draw BitmapData to clipC
4. Set mask of clipB to clipC ( check cacheAsBitmap == true )


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Andrew
Sinning
Sent: Thursday, February 07, 2008 9:15 AM
To: Flash Coders
Subject: [Flashcoders] copy mask from one clip to another

Using AS2 in CS3, what are the rough steps that I would need to take to 
copy an image from inside one clip and use it as the mask for an 
entirely different clip?

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] Yes or no: Moving one MC into another (AS2)

2008-02-07 Thread Jesse Graupmann
Michael,

>From what I understand, NO - although there are still a couple workarounds.



var mcA:MovieClip = this.attachMovie ( "myMovie", "mcA",
this.getNextHighestDepth() );
mcA.X = mcA.attachMovie ( "myMovie", "X", mcA.getNextHighestDepth(),
{_x:100, _xscale:120, _yscale:20 } );
var mcB:MovieClip = this.attachMovie ( "myMovie", "mcB",
this.getNextHighestDepth(), { _y:100 } );


//  Quick way of grabbing the initial settings from another clip
//  NOTE: These will just be set when the clip is instantiated - not ideal
for getter / setter information


function getMCData ( mc:MovieClip ):Object 
{
return { _x:mc._x, _y:mc._y, _width:mc._width, _height:mc._height,
_xscale:mc._xscale, _yscale:mc._yscale }; 
}

mcB.Y = mcB.attachMovie ( "myMovie", "Y", mcB.getNextHighestDepth(),
getMCData ( mcA.X ) );


//  If the MovieClips extended a custom class
//  you could ask for information to initialize another
//  once it hit the stage


mcB.Y.initialize ( mcA.X.getInitData () );




_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mendelsohn,
Michael
Sent: Thursday, February 07, 2008 6:24 AM
To: Flash Coders List
Subject: [Flashcoders] Yes or no: Moving one MC into another (AS2)

Hi list...

I have movieclip A, which contains movieclip X.  I also have movieclip
B, with no children, and I want it to contain a duplicate of A.X. 

Is it possible to do this in AS2?

Thanks,
- Michael M.

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

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


RE: [Flashcoders] How to call class method from a movieclip?

2008-01-31 Thread Jesse Graupmann
Funny! Your mom said the same thing to me last night...

;)

 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks
Sent: Wednesday, January 30, 2008 11:04 AM
To: Flash Coders List
Subject: Re: [Flashcoders] How to call class method from a movieclip?

Jesse Graupmann wrote:
 > function callMom ()
 > {
 >  trace( "YOU NEVER CALL" );
 > }

While we appreciate your code sample, Jesse, and we're all supportive of 
you, Flashcoders isn't a surrogate for your group therapy sessions.  ;)

Steven Sacks
Flash Maestro
Los Angeles, CA
--
blog: http://www.stevensacks.net
gaia: http://www.gaiaflashframework.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] How to call class method from a movieclip?

2008-01-30 Thread Jesse Graupmann


/// IN YOUR .FLA OR SOME CLASS



function callMom ()
{
trace( "YOU NEVER CALL" );
}


var mc:MyClip = new MyClip( this );
addChild ( mc );
mc.phoneHome();  





/// IN MYCLIP.AS AND LINKED IN THE LIBRARY TO YOUR MOVIECLIP




package 
{
import flash.display.MovieClip;
public class MyClip extends MovieClip 
{
public var home:*;
public function MyClip ( home:* )
{
this.home = home;
}

public function phoneHome ():void
{
home.callMom();
}

}
}




/// ON FRAME 2 OF YOUR MOVIECLIP



phoneHome(); 




_____

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Merrill,
Jason
Sent: Wednesday, January 30, 2008 8:00 AM
To: Flash Coders List
Subject: RE: [Flashcoders] How to call class method from a movieclip?

what is contentMC() ?  Looks like it doesn't take any arguments.  Where
is that defined?

Jason Merrill
Bank of America  
GT&O L&LD Solutions Design & Development 
eTools & Multimedia 

Bank of America Flash Platform Developer Community



 

>>-Original Message-
>>From: [EMAIL PROTECTED] 
>>[mailto:[EMAIL PROTECTED] On Behalf 
>>Of Irene Johansson
>>Sent: Wednesday, January 30, 2008 10:54 AM
>>To: Flash Coders List
>>Subject: Re: [Flashcoders] How to call class method from a movieclip?
>>
>>Thank you for your reply.
>>by doing this:
>>public class myClass extends Sprite{
>>
>>public function myClass() {
>>var contentMCs:MovieClip; = new contentMC(this); }
>>
>>public function myMethod(){
>>}
>>}
>>
>>I get this error msg: 1137: Incorrect number of arguments. 
>>Expected no more than 0.
>>
>>since contentMC is a
>>MovieClip that is attached from library i dont know where to 
>>define the parameters.
>>
>>Thanks for helping me
>>Irene
>>
>>
>>
>>On 1/30/08, Andy Herrman <[EMAIL PROTECTED]> wrote:
>>>
>>> If you want your contentMC class to be able to call methods on your 
>>> myClass then you should probably pass the myClass instance to the 
>>> contentMC.  Basically, add a parameter to contentMC's 
>>constructor of 
>>> type myClass, and pass a reference to 'this' when you create it.
>>> Something like this:
>>>
>>> public class myClass extends Sprite{
>>>
>>>   public function myClass() {
>>> var contentMCs:MovieClip; = new contentMC(this);
>>>   }
>>>
>>>   public function myMethod(){
>>>   }
>>> }
>>>
>>> On an unrelated note: standard practice has class names 
>>start with a 
>>> capital letter, not lowercase like you have.  It helps to 
>>> differentiate between variable names and class names.
>>>
>>>   -Andy
>>>
>>> On Jan 30, 2008 8:42 AM, Irene Johansson <[EMAIL PROTECTED]> wrote:
>>> > Hello!
>>> > I am having a big problem, hope someone can help me.
>>> >
>>> > I have made a class which i import in my flash file. The 
>>first and 
>>> > only frame of the file looks like this:
>>> >
>>> > import myClassFolder.*;
>>> > var myClassInstance:myClass = new myClass(this.stage); stop();
>>> >
>>> > Inside the class i am attaching a movieClip from a library and 
>>> > declaring
>>> a
>>> > methof:
>>> >
>>> > public class myClass extends Sprite{ var 
>>contentMCs:MovieClip = new 
>>> > contentMC(); ...
>>> > }
>>> > public function myMethod(){
>>> > }
>>> >
>>> > The contentMC contains 8 frames, each of the frame has a 
>>movieClip.
>>> >
>>> > In the frame 2 of the contentMC MovieClip i want to call 
>>myMethod of 
>>> > the myClass.
>>> > Anyone who know how to do this?
>>> > Thanks in advance
>>> > Irene

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


RE: [Flashcoders] parent property woes in AS3

2008-01-06 Thread Jesse Graupmann

var a:MovieClip = new MovieClip ();
var b:MovieClip = new MovieClip ();
a.addChild( b );

trace  (  MovieClip( b.parent ).play ) // function Function() {}

trace  ( ( b.parent as MovieClip ).play ) // function Function() {}

trace  (  b.parent.play ) // 1119: Access of possibly undefined property
play through a reference with static type
flash.display:DisplayObjectContainer.



_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Fumio Nonaka
Sent: Sunday, January 06, 2008 4:22 AM
To: Flash Coders List
Subject: Re: [Flashcoders] parent property woes in AS3

You should cast to the class.  About casting see the following:

Programming ActionScript 3.0 > ActionScript language and syntax > Data 
types > Type conversions:
http://livedocs.adobe.com/flash/9.0/main/0048.html
_
Omar Fouad wrote:
> so if I am inside a movieClip mc i should do:
> 
> mc(parent).play(); ???

> On Jan 6, 2008 5:45 AM, Fumio Nonaka <[EMAIL PROTECTED]> wrote:
>>The parent is a property of DisplayObject class, while the play() method
>>is belongs to MovieClip class which is a sub class of DisplayObject.
>>Therefore the reference of the property should be cast to MovieClip class.
>>
>>MovieClip(parent).play();
-- 
Fumio Nonaka

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


RE: [Flashcoders] Framework suggestions for games

2008-01-06 Thread Jesse Graupmann
These looked promising - never used em' though.

http://lab.polygonal.de/ds/ AS3 Data Structures for Game Developers
http://lab.polygonal.de/motor_physics/  Motor2
http://lab.polygonal.de/2007/12/31/motor-physics-released/


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ben gomez
farrell
Sent: Sunday, January 06, 2008 9:49 AM
To: Flashcoders mailing list
Subject: [Flashcoders] Framework suggestions for games

Hello, I'm currently working on a Flex project.  I'm really enjoying 
working with it, and since I'm basically doing a rich internet 
application it's saving tons of time.

Typically though, I do simple kids games.  Sometimes they aren't so 
simple.  Either way I'm wondering if there's one framework anyone can 
highly recommend for doing games (taking care of tasks like background 
scrolling, character movement, collision, collision resolving).

I can find plenty of physics and game frameworks, but I've come across 
too many to sort through, and was wondering if anybody had the magic bullet.

Oh I guess I'm primarily looking for AS3.  Thanks!
ben
___
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] toString(aArray[i]) ?? does this work

2007-09-12 Thread Jesse Graupmann
Maybe try;


var myStr:String  =  String( aArray[i] );

or

var myStr:String  =  aArray[i].toString();



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, September 10, 2007 8:30 PM
To: Flash Coders
Subject: [Flashcoders] toString(aArray[i]) ?? does this work


Quick question, can I toString an array element.  
ie:   var  myStr:String  =  toString(aArray[i]);// where 'i' is the
increment.

I am having an issue with this.  when I trace myStr it traces [object
object] 
instead of what I intended/expected "mcMovieClipName14" as a string.

Any insite would be appreciated.

Thanks in advance,

Paul V.

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

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


RE: [Flashcoders] OT: Force download PDF

2007-09-10 Thread Jesse Graupmann
SOURCE
http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm
?context=LiveDocs_Parts&file=2210.html 

NOTES
-   Max 100 MB for download
-   Only 1 download at a time

//
//
//  
//

import flash.net.FileReference;

var listener:Object = new Object();
var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);

listener.onSelect = function(file:FileReference):Void {
trace("onSelect: " + file.name);
}

listener.onCancel = function(file:FileReference):Void {
trace ("onCancel");
}

listener.onOpen = function(file:FileReference):Void {
trace ("onOpen: " + file.name);
}

listener.onProgress = function(file:FileReference, bytesLoaded:Number,
bytesTotal:Number):Void {
trace ("onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " +
bytesTotal);
}

listener.onComplete = function(file:FileReference):Void {
trace ("onComplete: " + file.name);
}

listener.onIOError = function(file:FileReference):Void {
trace ("onIOError: " + file.name);
}

//
//
//  
//


function downloadFile ()
{
var url:String = "http://www.MYDOMAIN/DIR/FILENAME.jpg";;
var success = fileRef.download (url, "savedFileName.jpg");
if ( success )
{
trace ("dialog box opened.");
}
else
{
trace ("dialog box failed to open!");
}
}

btn.onPress = downloadFile;





-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Corban
Baxter
Sent: Monday, September 10, 2007 9:32 AM
To: Flashcoders mailing list
Subject: [Flashcoders] OT: Force download PDF

hey if I put a pdf link i flash and I saw. getURL("mypdf.pdf"); it keeps
trying to open it in the browser. how can i force the browser to download
the pdf?

-- 
Corban Baxter
http://www.projectx4.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] Applying easing effect to type effect

2007-09-05 Thread Jesse Graupmann
import caurina.transitions.Tweener;

function typeEffect ( txt:TextField, words:String, tweenerObject:Object
):Object
{
var o = {
words:words,
per:0,
txt:txt
}

var to = tweenerObject != undefined ? tweenerObject : {}
to.per = 1;
to.onUpdate = function()
{
var inx = Math.round( this.per * this.words.length );
this.txt.text = (inx == this.words.length ) ? this.words :
this.words.substr ( 0, inx ) + '_';
};

Tweener.addTween ( o, to );

return o;
}

var tweenerObject:Object = {time:4, transition:'easeOutCubic'};
var effectObject:Object = typeEffect( myText, "This is a Basic Tweener
Typewriter", tweenerObject );



_____

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Omar Fouad
Sent: Tuesday, September 04, 2007 1:48 PM
To: Flashcoders mailing list
Subject: [Flashcoders] Applying easing effect to type effect

Hi,
i got the following code:

effect = function (txt) {
 string = txt;
 total = string.length;
 var ta:Array =[]
 for (i=0;ihttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


RE: [Flashcoders] Intro to OOP using ActionScript

2007-08-20 Thread Jesse Graupmann

http://www.debreuil.com/docs/ch01_Intro.htm   

http://www.kirupa.com/developer/oop2/AS2OOPindex.htm 

---

http://proto.layer51.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] [OT] Improve my design skills

2007-08-17 Thread Jesse Graupmann
Just look around, go to a contemporary bookstore and read up on design
history, and then see how it has evolved.

http://witcombe.sbc.edu/ARTHLinks.html
http://www.architectureweek.com/2001/0905/culture_1-1.html

http://www.typorganism.com/
http://typographica.org/

http://diuf.unifr.ch/people/bertinie/visuale/ 
http://infosthetics.com/ 
http://www.howdesign.com/blog/ 

http://www.smashingmagazine.com/ 

http://www.youworkforthem.com/

http://www.core77.com/
http://www.k10k.net/
http://styleboost.com/
http://www.thefwa.com/

http://www.joshspear.com/ 
http://spearcollective.com/ 
http://www.boredomisyourfault.com/blog/
http://www.designobserver.com/index.html
http://www.underconsideration.com/brandnew/
http://www.hallmonitor.org/blog/

http://www.commarts.com/ 

http://www.artlebedev.com/everything/id/ 
http://www.teague.com/ 

http://www.aiga.org/

http://www.wertco.com/ - industry resources

http://gizmodo.com 
http://www.hackaday.com
http://www.richardbanks.com/trends/


___
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] porting to Flash 8

2007-08-17 Thread Jesse Graupmann
Only you know your project, and that works just fine.

One idea to consider would be to try and minimize the memory footprint. 

By not messing up the MovieClip prototype, you keep your adjustments to only
relevant MovieClips that need those properties rather than every MovieClip.
Creating a single and central function for bounceMC and INIT_bounceMC
eliminates 10 extra functions and 8 extra properties in memory. Unless Speed
and Bounce change per MC, sharing 1 instance of each is better.

IMHO,
Jesse



function bounceMC ( mc:MovieClip )
{
mc.x = (mc.x * BOUNCE) + ((mc.xpos - mc._x) * SPEED);
mc.y = (mc.y * BOUNCE) + ((mc.ypos - mc._y) * SPEED);
mc._x += mc.x;
mc._y += mc.y;
}

function bounceEnter ( )
{
bounceMC ( mc );
bounceMC ( mc2 );
bounceMC ( mc3 );
bounceMC ( mc4 );
bounceMC ( mc5 );   
}

function INIT_bounceMC ( mc:MovieClip )
{
mc.x = mc.xpos = mc._x;
mc.y = mc.ypos = mc._y; 
}

function INIT ()
{
BOUNCE = 0.4;
SPEED = 0.9;

INIT_bounceMC ( mc );
INIT_bounceMC ( mc2 );
INIT_bounceMC ( mc3 );
INIT_bounceMC ( mc4 );
INIT_bounceMC ( mc5 );

onEnterFrame = bounceEnter;
}

INIT ();




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of coker todd
Sent: Thursday, August 16, 2007 10:42 PM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] porting to Flash 8

rather than having onClipEvents on each MC, why
wouldn't this work?

this.onLoad=function(){
mc.mcbounceload();
mc2.mcbounceload();
mc3.mcbounceload();
mc4.mcbounceload();
mc5.mcbounceload();
}


this.onEnterFrame = function(){
mc.mcbounceenter();
mc2.mcbounceenter();
mc3.mcbounceenter();
mc4.mcbounceenter();
mc5.mcbounceenter();
}

___
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] porting to Flash 8

2007-08-16 Thread Jesse Graupmann
Something more like... 


//
//  in FLA
//

//
//  linkageID: clip
//  AS2.0 Class: Ball
//


INIT ();

function INIT ()
{
var sx = 26;
var sy = 227;
var my = 20;
var mx = 0;

len = 6;
list = [];

for ( var i = 0; i < len; i++ ) 
{
var x = sx + ( i * mx );
var y = sy + ( i * my );

var posInfo = {
_on: { x:50, y:y },
_off: { x:x, y:y }
}   

var mc = this.attachMovie ( 'clip', 'mc_' + i,
this.getNextHighestDepth(), {posInfo:posInfo} );

mc.addEventListener ( "press", create ( this, pressHandler )
);  
list.push ( mc );
}
}

function pressHandler ( e:Object ) 
{
for ( var i = 0; i < len; i++ )  
{
var mc = list [ i ];
if ( mc != e.target ) 
{
mc.bounceTo ( mc.offPos );
}
else 
{
mc.bounceTo ( mc.onPos );
}
}
}

function create (s:Object, func:Function):Function
{
return function():Void{ func.apply(s, arguments);   };
}


//
//  in Ball.as
//


class Ball extends MovieClip 
{   
// dispatcher
private static var EventDispatcherDependancy =
mx.events.EventDispatcher.initialize ( Ball.prototype );
public var addEventListener:Function;
public var removeEventListener:Function;
public var dispatchEvent:Function;

// STATIC
public static var BOUNCE:Number = .4;
public static var SPEED:Number = .9;

// velocity
private var vx:Number = 0; 
private var vy:Number = 0;

// destination
private var dx:Number = 0; 
private var dy:Number = 0;;

// position info 
// example... {_on:{x:10,y:10} , _off:{x:0,y:0} };
private var posInfo:Object;

public function Ball ()
{
INIT();
}

public function get onPos( ):Number { return posInfo._on; }
public function get offPos( ):Number { return posInfo._off; }

public function bounceTo ( pos:Object ):Void 
{
if ( !isNaN (pos.x) ) dx = Math.round(pos.x *20)/20;
if ( !isNaN (pos.y) ) dy = Math.round(pos.y *20)/20;
onEnterFrame = centerBounce;
}

private function centerBounce ( ):Void
{
if ( _x != dx || _y != dy )
{
vx = ( vx * Ball.BOUNCE ) + (( dx - _x ) *
Ball.SPEED);
vy = ( vy * Ball.BOUNCE ) + (( dy - _y ) *
Ball.SPEED);
_x += vx;
_y += vy;
} 
else 
{   
onEnterFrame = null;
}
}

private function onPress_EVENT ()
{
this.dispatchEvent ( {type:'press', target:this});
}

public function INIT( ):Void 
{
// set on/off pos
_x = posInfo._off.x || 0;
_y = posInfo._off.y || 0;

// reset destination
dx = _x;
dy = _y;

// interaction
onPress = onPress_EVENT;
    }
}



_

Jesse Graupmann 
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of coker todd
Sent: Thursday, August 16, 2007 9:17 PM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] porting to Flash 8

Thanks Kerry, what would make it specific?


--- Kerry Thompson <[EMAIL PROTECTED]> wrote:

> Jesse Graupmann wrote:
>  
> > This works, but it's not really doing anything
> specific to AS2.0
> 
> :-)

___
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] porting to Flash 8

2007-08-16 Thread Jesse Graupmann
This works, but it's not really doing anything specific to AS2.0.


MovieClip.prototype.mcbounceload = function() 
{
this.bounce = 0.4;
this.speed = 0.9;
this.x = this.xpos = this._x;
this.y = this.ypos = this._y;
};

MovieClip.prototype.mcbounceenter = function()
{
this.x = (this.x * this.bounce) + ((this.xpos - this._x) *
this.speed);
this.y = (this.y * this.bounce) + ((this.ypos - this._y) *
this.speed);
this._x += this.x;
this._y += this.y;
};


mc.mcbounceload ();
mc.onEnterFrame = function()
{
this.xpos = _xmouse;
this.ypos = _ymouse;
this.mcbounceenter();
}


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of coker todd
Sent: Thursday, August 16, 2007 8:15 PM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] porting to Flash 8

so the new code reads:

MovieClip.prototype.mcbounceload = function () { 
bounce = 0.4;
speed = 0.9;
xpos = _x;
ypos = _y;
};

MovieClip.prototype.mcbounceenter = function () {
x = x*bounce+(xpos-_x)*speed;
_x += x;
y = y*bounce+(ypos-_y)*speed;
_y += y;

};

on each MC this is the code:

onClipEvent (load) {
mcfedernload();
}
onClipEvent (enterFrame) {
mcfedernenter();
}

code on each button:

on (release) {
_parent.mc2.xpos = 26;
_parent.mc2.ypos = 247;
_parent.mc3.xpos = 26;
_parent.mc3.ypos = 267;
_parent.mc4.xpos = 26;
_parent.mc4.ypos = 287;
_parent.mc5.xpos = 26;
_parent.mc5.ypos = 307;

Does this help??

___
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] porting to Flash 8

2007-08-16 Thread Jesse Graupmann
AS 2.0 is case sensitive. You can start by changing Movieclip to MovieClip

Not sure why you are using a function as a multiplier, so you might want to
get rid of theMover reference inside itself.



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of coker todd
Sent: Thursday, August 16, 2007 7:38 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] porting to Flash 8

Can someone please give me some tips as to what needs
to be changed in this script so it works with Flash 8,
I wrote this long ago in Flash 5, worked great, now I
need to publish a Flash 8 project and it does not
work??

Movieclip.prototype.setSpeed = function() {
federn = 0.4;
speed = 0.9;
xpos = _x;
ypos = _y;
};

Movieclip.prototype.theMover = function() {
x = x*theMover+(xpos-_x)*speed;
_x += x;
y = y*theMover+(ypos-_y)*speed;
_y += y;
};

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

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


RE: [Flashcoders] Q: Best solution for 360 pans in flash

2007-08-14 Thread Jesse Graupmann
http://www.visicam.de/ - Panorama360 ( Papervision3D )
http://www.popforge.de/ - CubicVR360

___
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] division operand

2007-08-14 Thread Jesse Graupmann

On the TextField properties, try Embed > Include these characters > ÷



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of natalia
Vikhtinskaya
Sent: Tuesday, August 14, 2007 2:41 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] division operand

I have this
operand="÷";
item.text=operand+" "+String(i);
trace(item.text) /// ÷ 1
but I don't see that operand in text area.
text area: not html, Arial, all embedded
text area HTML: the same I see operand in trace but I don't see on the
screen

Any idea?

2007/8/14, Cedric Muller <[EMAIL PROTECTED]>:
> Hello,
>
> You mean that you just need this 'convention' for display purposes ?
>
> var str = "10 / 2=";
> trace(str); //  outputs: 10 / 2=
> str = str.split("/").join("÷");
> trace(str); //  outputs: 10 ÷ 2=
>
> hth,
> Cedric
>
> > "10 / 2=" I need "10 ÷ 2 ="
>
> ___
> 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] array copy with random order

2007-08-13 Thread Jesse Graupmann
@Mark - Thanks for the suggestion

@Steven - Thanks for the code! This does work better than the others.

 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks
Sent: Monday, August 13, 2007 3:16 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] array copy with random order

Fisher-Yates shuffle algorithm in AS2:

function fisherYates(myArray:Array):Void
{
 var i:Number = myArray.length;
 if (i > 0)
 {
 while (--i)
 {
 var j:Number = Math.floor(Math.random() * (i + 1));
 var tempi:Object = myArray[i];
 var tempj:Object = myArray[j];
 myArray[i] = tempj;
 myArray[j] = tempi;
 }
 }
}


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Hawley
Sent: Monday, August 13, 2007 2:45 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] array copy with random order

Just look up "Fisher-Yates shuffle" and use it. It's better than any number
of home-rolled randomizers.

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

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


RE: [Flashcoders] array copy with random order

2007-08-13 Thread Jesse Graupmann
Steven,

I'm not really sure how to compare the differences between array sorts, but
this seemed pretty straight forward.

>From what I can tell, using Math.round(Math.random()*2)-1 produced less
movement in original number position than Math.round(Math.random()).



//
//  TEST
//

var array = [0,1, 2, 3, 4, 5, 6, 7, 8, 9 ];

function randomizeArray ( a ) {
// 0, 1
var na = [].concat(a).sort ( function (){ return
Math.round(Math.random()); } );
analyzeArray( na );
return na;
}
function randomizeArray2 ( a ) {
// -1, 0, 1
var na = [].concat(a).sort ( function (){ return
Math.round(Math.random()*2)-1; } );
analyzeArray( na );
return na;
}

function analyzeArray ( a ) 
{
var len = a.length;
var mov = new Array (len);
var med = 0; 
var avg = 0; // average movement
var ttl = 0; // total movement

for ( var i = 0; i < len; i++ )
{
var num = a[i];
var dist = i-num;
mov [num] = dist; 
med += dist;
ttl += Math.abs( dist );
}

avg = ttl / len;
trace('\nttl: ' + ttl + '   avg: ' + avg + '   med: ' + med + '
mov: ' + mov )
}

trace( '\n++ 1\n');

trace (randomizeArray ( array ));
trace (randomizeArray ( array ));
trace (randomizeArray ( array ));
trace (randomizeArray ( array ));
trace (randomizeArray ( array ));
trace (randomizeArray ( array ));
trace (randomizeArray ( array ));

trace( '\n++ 2\n');

trace (randomizeArray2 ( array ));
trace (randomizeArray2 ( array ));
trace (randomizeArray2 ( array ));
trace (randomizeArray2 ( array ));
trace (randomizeArray2 ( array ));
trace (randomizeArray2 ( array ));
trace (randomizeArray2 ( array ));

trace( '\n++ org\n');

trace( array ); // no change good


//
//  OUTPUT
//

++ 1


ttl: 30   avg: 3   med: 0   mov: 7,0,6,2,-1,-1,0,-7,-6,0
7,1,8,4,5,3,6,0,2,9

ttl: 38   avg: 3.8   med: 0   mov: 9,-1,2,5,2,-2,1,-5,-3,-8
1,9,7,5,2,8,4,6,3,0

ttl: 22   avg: 2.2   med: 0   mov: 4,1,-1,-3,4,2,0,-2,-5,0
3,2,1,8,0,7,6,5,4,9

ttl: 12   avg: 1.2   med: 0   mov: 4,0,-2,0,-2,0,0,1,1,-2
2,1,4,3,0,5,6,9,7,8

ttl: 30   avg: 3   med: 0   mov: 7,0,4,-1,-4,4,-1,-3,-5,-1
4,1,3,8,7,6,2,0,9,5

ttl: 22   avg: 2.2   med: 0   mov: 7,0,-2,2,0,1,-3,1,-6,0
2,1,8,6,4,3,5,0,7,9

ttl: 36   avg: 3.6   med: 0   mov: 7,2,6,3,-2,0,-5,-7,-4,0
7,6,4,1,8,5,3,0,2,9

++ 2


ttl: 16   avg: 1.6   med: 0   mov: 0,5,3,-1,-3,-2,-2,0,0,0
0,4,3,5,6,2,1,7,8,9

ttl: 24   avg: 2.4   med: 0   mov: 0,0,7,1,2,-2,2,-2,-1,-7
0,1,9,5,3,7,4,8,6,2

ttl: 32   avg: 3.2   med: 0   mov: 1,8,3,0,2,-3,2,0,-4,-9
9,0,5,3,8,2,4,7,6,1

ttl: 10   avg: 1   med: 0   mov: 0,0,1,4,0,-3,0,-2,0,0
0,1,5,2,4,7,6,3,8,9

ttl: 22   avg: 2.2   med: 0   mov: 0,0,4,5,1,-1,-4,0,1,-6
0,1,6,9,5,4,2,7,3,8

ttl: 20   avg: 2   med: 0   mov: 0,2,2,-1,3,3,-5,-1,-3,0
0,6,3,1,2,8,7,4,5,9

ttl: 22   avg: 2.2   med: 0   mov: 1,6,0,0,0,4,-1,-1,0,-9
9,0,2,3,4,6,7,1,8,5

++++++ org

0,1,2,3,4,5,6,7,8,9




_

Jesse Graupmann
www.jessegraupmann.com  
www.justgooddesign.com/blog/ 
_


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks
Sent: Monday, August 13, 2007 11:23 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] array copy with random order

 > array2.sort ( function (){ return Math.round(Math.random()); } );

That's brilliant!  :)

To build upon that with all 3 outcomes (-1, 0, 1), you can use:

Math.round(Math.random() * 2) - 1)

___
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] Dynamically setting properties...

2007-08-13 Thread Jesse Graupmann
//
//  ver 1
//

props = { _isActive:'blah blah' };
// myclass_mc | AS2.0 Class = myclass
var mc = this.attachMovie( 'myclass_mc', 'mc', 1, props ); 
trace( mc.isActive ); // blah blah


//
//  ver 2
//

var mc = this.attachMovie( 'myclass_mc', 'mc', 1 ); // AS2.0 Class = myclass
trace( mc.isActive ); // false
props = { isActive:true };
mc.setProps ( props );
trace( mc.isActive ); // true



//
//  myclass.as
//

class myclass extends MovieClip
{
private var _isActive = false;
public function myclass ()
{
}
public function get isActive():Boolean { return _isActive }
public function set isActive( b:Boolean ){ _isActive = b }
public function setProps ( props:Object ):Void
{
for ( var i in props )
{
if ( typeof (this[i]) != undefined && props[i] !=
undefined ) this[i] = props[i];
    }
    }
}



_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Karim
Beyrouti
Sent: Wednesday, August 08, 2007 10:09 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Dynamically setting properties...

Hi List,


I am trying to add values to properties a classes, the classes properties
are defined like this:

function get isActive():Boolean{ return _isActive; }
function set isActive( val:Boolean):Void{ _isActive= val; }

 so instead of douing this to add values to the class:

if ( obj.isActive!= undefined ) myClass.isActive = obj.isActive

I am trying to do something like this ( as I have quite a lot of properties
/ different classes ):

for ( var i in obj ) {

a_sprite[i] = obj[i]

}

But no joy... and well... has anyone been there with this one.?...



Regards


Karim

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

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

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

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


RE: [Flashcoders] array copy with random order

2007-08-13 Thread Jesse Graupmann
var array = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ];

var array2 = [].concat(array);

array2.sort ( function (){ return Math.round(Math.random()); } );

trace( array ); // 0,1,2,3,4,5,6,7,8,9
trace( array2 ); // 8,2,3,6,5,4,1,7,0,9


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of natalia
Vikhtinskaya
Sent: Monday, August 13, 2007 2:29 AM
To: Flashcoders mailing list
Subject: [Flashcoders] array copy with random order

Hi

I have one Array with random numbers [40,32,90,76,66]

I need copy of this array but the order should be different and random.
Something like this: [76,90,40,32,66]. How can this be done?
Thanks for any help.
___
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] Q:Watch vs listener/broadcaster

2007-08-13 Thread Jesse Graupmann
I like to think of the watch like a filter. I first started using watch
because you can get immediate notification of a change and then run an event
because of that change. But because you have to return the value in order
for it to get set, it makes more sense to use a getter/setter if you want to
run events after the property has been changed or accessed.

I have used watch to run functions and pass arguments via a string set by
javascript. In that case, saving the string wasn't as important as receiving
the immediate event and parsing the function and arguments. 

swf.SetVariable("watchVar", args )

As for the difference between watch vs. listener/broadcaster, it's a lot
like comparing apples and oranges. 


//
//  watch
//


var width = 0;
var height = 0;
var max = 100;

watch ( 'width', validateNumber, max );
watch ( 'height', validateNumber, max );

function validateNumber ( prop:String, o, n, extra ):Number
{
if (isNaN(n)) { return o } else { return Math.min(extra,n) };
}

function area():Number
{
return width * height;
}

width = 50;
height = 2;
trace( area() ); // 100

width = 100;
trace( area() ); // 200

width = 200;
trace( area() ); // 200

height = 'random string';
trace( area() ); // 200



//
//  getter / setter
//



__width = 0;
__height = 0;
__area = 0;

addProperty( 'width', get_width, set_width );
addProperty( 'height', get_height, set_height );
addProperty( 'area', get_area, null );

function get_height():Number{return __height }
function get_width():Number{return __width }
function get_area():Number{return __area }

function set_height( val:Number ):Void
{
if ( isNaN(val)) return;
__height = val;
calculateArea();
}
function set_width( val:Number ):Void
{
if ( isNaN(val)) return;
__width = val;
calculateArea();
}

function calculateArea ():Void 
{
__area = __height * __width;
}

width = 2;
height = 10;
trace ( area ) // 20


_

Jesse Graupmann
www.jessegraupmann.com   
www.justgooddesign.com/blog/
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Saturday, August 11, 2007 12:06 PM
To: flashcoders
Subject: [Flashcoders] Q:Watch vs listener/broadcaster

Hi
I'm aware of watch, but have never really used it.
I was wondering if perhaps I am missing out on a really useful tool.

Can someone  give me an example of when it would make sense to use watch
instead of setting up a listener broadcaster?

[e] jbach at bitstream.ca
[c] 416.668.0034
[w] www.bitstream.ca

"...all improvisation is life in search of a style."
 - Bruce Mau,'LifeStyle'
___
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] Finding a spot on a curveTo Line

2007-08-10 Thread Jesse Graupmann
Some more easing curves and another approach 



// Quadratic Bezier tween from b to b+c, influenced by p
// t: current time, b: beginning value, c: total change, d: duration
// p: Bezier control point position
function tweenQuadBez (t, b, c, d, p):Number {
return ((t/=d)*c + 2*(1-t)*(p-b))*t + b;
};


// Quadratic Bezier tween from b to b+c, passing through p
// t: current time, b: beginning value, c: total change, d: duration
// p: point to pass through at halftime
function tweenQuadBezThru (t, b, c, d, p):Number {
return ((t/=d)*c + 2*(1-t)*(2*p-b-.5*c-b))*t + b;
};


// Cubic Bezier tween from b to b+c, influenced by p1 & p2
// t: current time, b: beginning value, c: total change, d: duration
// p1, p2: Bezier control point positions
function tweenCubicBez (t, b, c, d, p1, p2):Number {
return ((t/=d)*t*c + 3*(1-t)*(t*(p2-b) + (1-t)*(p1-b)))*t + b;
};




function update()
{
var per = _xmouse/Stage.width;

var ny = tweenQuadBez ( per, 0, (y2-y1), 1, (yp-y1) ) + y1;
var nx = tweenQuadBez ( per, 0, (x2-x1), 1, (xp-x1) ) + x1;

circle_mc._y = ny;
circle_mc._x = nx;
}



function INIT()
{
Stage.align = 'TL';
Stage.scaleMode = 'noScale';

x1 = 50;
y1 = 50;
xp = 100;
yp = 50;
x2 = 300;
y2 = 200;

// CURVE
this.createEmptyMovieClip("curve_mc", this.getNextHighestDepth());
curve_mc.lineStyle(0, 0x33, 80);
curve_mc.moveTo( x1, y1 );
curve_mc.curveTo( xp, yp, x2, y2);

// CIRCLE
var radius = 5;
circle_mc = this.createEmptyMovieClip("circle_mc",
this.getNextHighestDepth() );
circle_mc.lineStyle(0, 0x00);
drawCircle(circle_mc, 0, 0, radius);

onMouseMove = update;
}



INIT();



function drawCircle(mc:MovieClip, x:Number, y:Number, r:Number):Void {
mc.moveTo(x+r, y);
mc.curveTo(r+x, Math.tan(Math.PI/8)*r+y, Math.sin(Math.PI/4)*r+x, 
Math.sin(Math.PI/4)*r+y);
mc.curveTo(Math.tan(Math.PI/8)*r+x, r+y, x, r+y);
mc.curveTo(-Math.tan(Math.PI/8)*r+x, r+y, -Math.sin(Math.PI/4)*r+x, 
Math.sin(Math.PI/4)*r+y);
mc.curveTo(-r+x, Math.tan(Math.PI/8)*r+y, -r+x, y);
mc.curveTo(-r+x, -Math.tan(Math.PI/8)*r+y, -Math.sin(Math.PI/4)*r+x, 
-Math.sin(Math.PI/4)*r+y);
mc.curveTo(-Math.tan(Math.PI/8)*r+x, -r+y, x, -r+y);
mc.curveTo(Math.tan(Math.PI/8)*r+x, -r+y, Math.sin(Math.PI/4)*r+x, 
-Math.sin(Math.PI/4)*r+y);
mc.curveTo(r+x, -Math.tan(Math.PI/8)*r+y, r+x, y);
}




_____

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_


___
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] Coding a circular preloader

2007-08-06 Thread Jesse Graupmann
Another version using _xmouse to get a Stage.width factor so you can see
easing via onMouseMove. 

Nothing extra needed in this example - just copy/paste.

- JG





function drawArc ( mc, x, y, radius, arc, startAngle, yRadius) 
{
// http://www.formequalsfunction.com/downloads/drawmethods.html

if (arguments.length<5) return;
if (yRadius == undefined) yRadius = radius;
var segAngle, theta, angle, angleMid, segs, ax, ay, bx, by, cx, cy;
if (Math.abs(arc)>360) arc = 360;
segs = Math.ceil(Math.abs(arc)/45);
segAngle = arc/segs;
theta = -(segAngle/180)*Math.PI;
angle = -(startAngle/180)*Math.PI;
ax = x-Math.cos(angle)*radius;
ay = y-Math.sin(angle)*yRadius;
if (segs>0) {
for (var i = 0; i>1));
txt._y = Math.round(circle_holder._y + (circle_top.radius*2) +
circle_top.lineStyle[0]);
}

//
//  ADJUST TO NEW PERCENTAGE
//

function adjust_view () 
{
// per
var margin = 20;
var per = Math.max( 0 , Math.min ( 1, (this._xmouse - margin) /
(Stage.width-(margin*2;
var new_arc = Math.round( -360 * per );

// update
if ( new_arc != dest_arc ) 
{
dest_arc = new_arc;
circle_holder.onEnterFrame = function()
{
cur_arc += (dest_arc - cur_arc) * .1 ;
circle_top.arc = cur_arc;
circle_draw ( circle_top ); // circle
setPer (
Math.round(Math.abs(circle_top.arc)/360*100) ); // txt
if ( cur_arc == dest_arc ) delete
circle_holder.onEnterFrame;
}
}
}


//
//  CREATE
//

function INIT()
{

// circle
circle_holder = this.createEmptyMovieClip( "circle_holder", 20 );
cur_arc = 0;
dest_arc = 0;

// top circle
circle_top = {
mc: circle_holder.createEmptyMovieClip( "mc", 40 ),
x:0,
y:0,
radius:50,
arc: 0,
startAngle: 90,
yRadius: 50,
lineStyle: [ 15, 0xFF, 100 ],
fillStyle: [ ]
};

// add top glow
circle_top.mc.filters = [ new flash.filters.GlowFilter(0xFF, .8,
15, 15, 2, 3, false, false ) ];
// bottom circle
circle_bottom = {
mc: circle_holder.createEmptyMovieClip( "mc2", 30  ),
arc: 360,
x: circle_top.x,
y: circle_top.y,
radius: circle_top.radius,
startAngle: circle_top.startAngle,
yRadius: circle_top.yRadius,
lineStyle: [ 13, 0xFF, 20 ],
fillStyle: circle_top.fillStyle
};  

// txt
txt = this.createTextField("txt", 100, 100, 100, 300, 100);
txt.multiline = false;
txt.autoSize= true;
txt.wordWrap = false;
txt_fmt = new TextFormat();
txt_fmt.color = 0xFF;


// stage
Stage.scaleMode = 'noScale';
Stage.align = 'TL';
Stage.addListener( this );
bg = this.createEmptyMovieClip("bg", 10 );
onResize = function ()
{
var W = Stage.width;
var H = Stage.height;
bg.clear();
bg.beginFill(0x33, 100);
bg.moveTo(0, 0);
bg.lineTo(W, 0);
bg.lineTo(W, H);
bg.lineTo(0, H);
bg.lineTo(0, 0);
bg.endFill();

circle_holder._x = (W>>1);
circle_holder._y = (H>>1)- circle_top.radius;
}
circle_draw ( circle_top );
circle_draw ( circle_bottom );

onMouseMove = adjust_view;
    onResize();
setPer ( 0 );
}

INIT();





_

Jesse Graupmann
www.jessegraupmann.com  
www.justgooddesign.com/blog/   
_____

-----Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jesse
Graupmann
Sent: Monday, August 06, 2007 4:24 PM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] Coding a circular preloader


Using the arc prototype ( AS 1/2 ) from formequalsfunction draw methods;
http://www.formequalsfunction.com/downloads/drawmethods.html and Tweener (
AS 2 ) from http://code.google.com/p/tweener/ I put together a simple tween
version of the circle.

Assuming you have Tweener in the same directory, you can copy and paste this
example.

- JG



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Omar Fouad
Sent: Monday, Aug

RE: [Flashcoders] Coding a circular preloader

2007-08-06 Thread Jesse Graupmann
mc: this.createEmptyMovieClip( "mc2", 20  ),
arc: 360,
x: circle_obj.x,
y: circle_obj.y,
radius: circle_obj.radius,
startAngle: circle_obj.startAngle,
yRadius: circle_obj.yRadius,
lineStyle: [ 13, 0xFF, 20 ],
fillStyle: circle_obj.fillStyle
};  

// draw base
circle_draw ( obj_base );


}

function INIT_glow ()
{
// add top glow
var color:Number = 0xFF;
var alpha:Number = .8;
var blurX:Number = 15;
var blurY:Number = 15;
var strength:Number = 2;
var quality:Number = 3;
var inner:Boolean = false;
var knockout:Boolean = false;
var glow_filter:GlowFilter = new GlowFilter(color, 
alpha, 
blurX, 
blurY, 
strength, 
quality, 
inner, 
knockout);
circle_obj.mc.filters = [ glow_filter ];
}

function INIT_tween ( )
{
// tween top - alpha
circle_obj.mc._alpha = 0;
Tweener.addTween ( circle_obj.mc, {
  _alpha:100,
  time:1,
  delay:.5,
  transition:'easeOutCubic'


})

// tween top - arc
Tweener.addTween ( circle_obj, {
arc:-360,
time:4,
delay:.2,
transition:'easeInOutCubic',
onUpdate: mx.utils.Delegate.create ( this, updateCircle ),
onUpdateParams:[ circle_obj ]
    });
}

// starts draw and tween
INIT(); 



_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Omar Fouad
Sent: Monday, August 06, 2007 2:09 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Coding a circular preloader

Hahaha Steven :D that was a good one ;). Thanks david.. but I don't have
it.. i'll try to convince my boss. But i would like to know the same how
that could be achieved like in the website.

-- 
Omar M. Fouad

___
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] textures

2007-07-20 Thread Jesse Graupmann
Cryzto,
I think this gets you one step closer.


Bump Mapping in Flash
http://drawk.wordpress.com/2007/04/18/bump-mapping-in-flash/

found via:
3D Materials, Texturing and Mapping in AS3 and the Limits of Flash and
Software Rendering
http://drawk.wordpress.com/2007/07/07/3d-materials-texturing-and-mapping-in-
as3-and-the-limits-of-flash-and-software-rendering/

-

Flash 8 Example : "3d" BumpMapping using Filters. (source included)
http://www.unitzeroone.com/blog/flash_examples/flash_8_example_3d_bumpmappin
g_using_filters_source_included.html




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Cristo @
Cryzto
Sent: Tuesday, July 17, 2007 6:58 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] textures

If I've got a plain vector-rectangle (with radial-color) and want to give it
a texture (-fill) per actionscript. how can I achieve that? Is it even
possible?

Thnx 4 answering.
Cryzto

___
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] AS 2.0 Tweening libraries

2007-07-18 Thread Jesse Graupmann
WWMND - What would Muzak not do? Yes, Jesse?

Tweener makes you jump higher, live longer, save the world, AND gives you
more attractive examples http://labs.blitzagency.com/?p=314

"oh boy.."


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Wednesday, July 18, 2007 3:15 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] AS 2.0 Tweening libraries


As I mentioned earlier, I use Animation Package:
http://www.alex-uhlmann.de/flash/animationpackage/ 
Not saying it's perfect or *the best*..

And here's some stuff Alex has been doing in Flex
http://weblogs.macromedia.com/auhlmann/archives/2007/03/distortion_effe.cfm 
http://www.alex-uhlmann.de/flash/adobe/blog/distortionEffects/effectCube/ 


regards,
Muzak

___
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] AS 2.0 Tweening libraries

2007-07-18 Thread Jesse Graupmann
#import "mc_tween2.as"

I've used Zeh's MC Tween hundreds of times. Probably because I started out
with Ladislav Zigo's engine and it solved all the callback issues. Sure,
putting it in an AS 2.0 project takes a little trick, but toss in a Delegate
or two for a callback and you have a sequencer!

While I would recommend Tweener, Fuse, or TweenLite from here on out - I
still gotta say MC Tween: it saves the world!

THANKS ZEH!


You can see a list of other tween engines over at
http://www.justgooddesign.com/blog/scripted-animation-tweened-and-eased.htm


What might change your mind about switching from any of these to another? 

-   Size
-   Syntax
-   Sequencing

_____

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Alan
MacDougall
Sent: Wednesday, July 18, 2007 6:48 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] AS 2.0 Tweening libraries

So, coming off the enterFrame() tween discussion, a lot of people 
mentioned various tweening libraries. I still use Fuse, which has proven 
extremely capable for my purposes; are there any pressing flaws in Fuse, 
or benefits in the other packages, that might convince me to change?

___
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] textures

2007-07-17 Thread Jesse Graupmann
Without practical knowledge, I would suggest either
flash.filters.DisplacementMapFilter or mc.beginBitmapFill along with
mc.blendMode.

//
// DisplacementMapFilter
//

Maybe something like these mixed with a tiled bitmaps?

http://www.reflektions.com/miniml/template_permalink.asp?id=334
http://lab.andre-michelle.com/panorama
http://lab.andre-michelle.com/gooify 
http://nodename.com/blog/2006/01/16/psyarks-displacementmapfilter-tutorial/



//
// beginBitmapFill
//

The example below creates a tiled Bitmap image the size of an attached
vector MovieClip, attaches a duplicate to use as the Bitmap's mask, and
applies a blendMode from the Bitmap MovieClip over the base vector image.


var bmp = flash.display.BitmapData.loadBitmap( 'bitmap_linkageID' );
/*actual jpg or png*/
var base = this.attachMovie ( 'vector_image_linkageID3', 'base',
this.getNextHighestDepth() );
var mask = this.attachMovie ( 'vector_image_linkageID3', 'mask',
this.getNextHighestDepth() );
var bmp_mc = this.createEmptyMovieClip ( 'bmp_mc',
this.getNextHighestDepth() );

var useBitmapFill = true;
var adjustScale = false;
var blend_mode = 'difference';


if ( useBitmapFill ) 
{
var matx = new flash.geom.Matrix();
if ( adjustScale ) 
{
base._xscale = mask._xscale = bmp_mc._xscale = 200; /*test*/
// adjust for scale distortion
matx.a = 1 / (bmp_mc._xscale/100);
matx.d = 1 / (bmp_mc._yscale/100);
}

bmp_mc.clear();
bmp_mc.beginBitmapFill(bmp, matx, true, false);

var W = base._width || mask._width;
var H = base._height|| mask._height;
with (bmp_mc)
{
moveTo(0, 0);
lineTo(W, 0);
lineTo(W, H);
lineTo(0, H);
lineTo(0, 0);
endFill();
}
} 
else 
{
bmp_mc.attachBitmap ( bmp, bmp_mc.getNextHighestDepth() );
}

bmp_mc.cacheAsBitmap = true;
mask.cacheAsBitmap = true;
bmp_mc.setMask ( mask );

bmp_mc.blendMode = blend_mode;



_

Jesse Graupmann
www.jessegraupmann.com
www.justgooddesign.com/blog/
_




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Cristo @
Cryzto
Sent: Tuesday, July 17, 2007 6:58 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] textures

Hi everybody!

 

I've surely got a interesting question:

 

If I've got a plain vector-rectangle (with radial-color) and want to give it
a texture (-fill) per actionscript. how can I achieve that? Is it even
possible?

 

Thnx 4 answering.

 

Cryzto

 


  _  

Ich verwende die kostenlose Version von SPAMfighter,
die bei mir bis jetzt 1341 Spammails entfernt hat.
Fur private Anwender ist SPAMfighter vollig kostenlos!
Jetzt gratis testen: hier klicken <http://www.spamfighter.com/lde> . 
___
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] onEnterFrame() and delete onEnterFrame()

2007-07-17 Thread Jesse Graupmann
Ok, so no scope change and no extra tween class. Isn't over engineering
considered bad practice? And aren't all the cool kids are using
http://code.google.com/p/tweener/ right now anyway?


;)




//
//  FRAME VERSION
//

var a = 0;
for (var i:Number = 0; i < 5; i++) 
{ 
var mc = templates.duplicateMovieClip( "templates_" + i,
this.getNextHighestDepth()); 
mc._y = ( i * 50 ) + 100;
mc._alpha = a;
}

function onEnterFrame ( )
{
if ( (a += 5) > 100 ){ delete a; delete onEnterFrame; } else 
for (var i:Number = 0; i < 5; i++) this[ "templates_" + i]._alpha =
a;
}




//
//  TIME VERSION
//


var t = 1000;
var d = getTimer() + t;
for (var i:Number = 0; i < 5; i++) 
{ 
var mc = templates.duplicateMovieClip( "templates_" + i,
this.getNextHighestDepth()); 
mc._y = ( i * 50 ) + 100;
mc._alpha = 0;
}

function onEnterFrame ( )
{
var a = 100-(((d-getTimer())/t)*100);
if (a>100){ delete d; delete t; delete onEnterFrame; }
for (var i:Number = 0; i < 5; i++) this[ "templates_" + i]._alpha =
a;
}




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Tuesday, July 17, 2007 5:25 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] onEnterFrame() and delete onEnterFrame()

Well, both are bad practice (IMO).

I'd go for an animation engine, like animationpackage:
http://www.alex-uhlmann.de/flash/animationpackage/

- Original Message - 
From: "Jesse Graupmann" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, July 18, 2007 1:34 AM
Subject: RE: [Flashcoders] onEnterFrame() and delete onEnterFrame()


>I was just making an example based on this article.
>
> http://timotheegroleau.com/Flash/articles/scope_chain.htm
>
> "#6 To avoid memory waste, a simple solution is to not use nested function
> but create function externaly instead and attach references only."
>
> So would that still be bad practice for AS 1.0 considering nothing gets
> referenced beyond the scope of this?
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Muzak
> Sent: Tuesday, July 17, 2007 4:13 PM
> To: flashcoders@chattyfig.figleaf.com
> Subject: Re: [Flashcoders] onEnterFrame() and delete onEnterFrame()
>
>
> - Original Message - 
> From: "Jesse Graupmann" <[EMAIL PROTECTED]>
> To: 
> Sent: Wednesday, July 18, 2007 12:49 AM
> Subject: RE: [Flashcoders] onEnterFrame() and delete onEnterFrame()
>
>
>> You could make it just a bit more lean than that...
>>
>
> Except that fadeInMc() now runs in a different scope => bad practice.

___
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] onEnterFrame() and delete onEnterFrame()

2007-07-17 Thread Jesse Graupmann
I was just making an example based on this article.

http://timotheegroleau.com/Flash/articles/scope_chain.htm

"#6 To avoid memory waste, a simple solution is to not use nested function
but create function externaly instead and attach references only."

So would that still be bad practice for AS 1.0 considering nothing gets
referenced beyond the scope of this?


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Tuesday, July 17, 2007 4:13 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] onEnterFrame() and delete onEnterFrame()


- Original Message - 
From: "Jesse Graupmann" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, July 18, 2007 12:49 AM
Subject: RE: [Flashcoders] onEnterFrame() and delete onEnterFrame()


> You could make it just a bit more lean than that...
>

Except that fadeInMc() now runs in a different scope => bad practice. 


___
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] onEnterFrame() and delete onEnterFrame()

2007-07-17 Thread Jesse Graupmann
You could make it just a bit more lean than that...



for (var i:Number = 0; i < 5; i++) 
{ 
var mc = templates.duplicateMovieClip( "templates" + i,
templates._parent.getNextHighestDepth()); 
mc._y = ( i * 50 ) + 100;
mc._alpha = 0;
mc.onEnterFrame = fadeInMc;
}

function fadeInMc ( )
{
this._alpha += 5;
if ( this._alpha >= 100 ) 
{
trace( 'faded: ' + this );
this.onEnterFrame = null;
}
}



_____

Jesse Graupmann
www.jessegraupmann.com  
www.justgooddesign.com/blog/   
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Keith
Reinfeld
Sent: Tuesday, July 17, 2007 2:18 PM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] onEnterFrame() and delete onEnterFrame()

This works:
 
 
var yPos:Number = 50; 
for (var i:Number = 0; i < 5; i++) { 
duplicateMovieClip(templates, "templates" + i,
this.getNextHighestDepth()); 
var mc:MovieClip = this["templates" + i]; 
yPos += 50; 
mc._y = yPos; 
mc._alpha = 0; 
fadeInTemplates(mc); 
} 
function fadeInTemplates(mc):Void { 
mc.onEnterFrame = function() { 
if (mc._alpha < 100) { 
mc._alpha += 5; 
} else { 
delete mc.onEnterFrame; 
trace("delete mc = " + mc); 
} 
} 
}; 
 
 
HTH 

-Keith 
http://keithreinfeld.home.comcast.net
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of macromedia
flash
Sent: Tuesday, July 17, 2007 3:46 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] onEnterFrame() and delete onEnterFrame()

hi there,

I am workin on the the script below, and have problem for onEnterFrame()
action.

1. there is an movieclip on my stage and assigned the Instance Name to
"templates".
2. I would like to use duplicateMovieClip to create 5 more templates on the
stage and have fade in effects.
3. After that, delete the onEnterFrame() action.

However, the onEnterFrame() doesn't work, would you please help me to have a
look?

Best Regards

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

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


RE: [Flashcoders] obfuscation swf !

2007-07-17 Thread Jesse Graupmann
"Check it out, and see if you can 'steal' this game - it is yours for the
taking:"

Instead of "Alert!" you should have wrote, "Congrats! This game is yours!"


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Frederic
Caron
Sent: Tuesday, July 17, 2007 9:32 AM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] obfuscation swf !

I've just save as and uncompile .. I don't get where's the revolution? 

"message = "Alert! This movie\'s copyrights are being infringed! A message
is being sent to the author that you have copied his work. \nOffending
website path: " + _url;"

___
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] Arguments.callee._name?

2007-07-16 Thread Jesse Graupmann
I wouldn't say i wudnt clutter everything when I don't know the reasoning
behind getting a called function name in the first place. I also wouldn't
clutter anything with two unneeded classes for a simple property check. ;)

Regards
JG
 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Hans Wichman
Sent: Monday, July 16, 2007 1:30 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Arguments.callee._name?

Hi,
i wudnt clutter everything with delegates and extra function creations when
its not needed:)

greetz
JC



On 7/16/07, Jesse Graupmann <[EMAIL PROTECTED]> wrote:
>
> For variety sake, here is a simple alternative.
>
>
> mx.events.EventDispatcher.initialize ( mc );
>
> handleEvent ( mc, 'onPress' );
> handleEvent ( mc, 'onRelease' );
> handleEvent ( mc, 'onReleaseOutside' );
>
> mc.addEventListener ( 'onPress', mx.utils.Delegate.create ( this,
> eventHandler ) )
> mc.addEventListener ( 'onRelease', mx.utils.Delegate.create ( this,
> eventHandler ) )
> mc.addEventListener ( 'onReleaseOutside', mx.utils.Delegate.create ( this,
> eventHandler ) )
>
> function handleEvent ( obj:Object, event:String )
> {
>obj [ event ] = function(){this.dispatchEvent ({type:event,
> target:this }) }
> }
>
> function eventHandler ( evt:Object )
> {
>trace( evt.type + '\t\t\t' + evt.target );
> }
>
>
>
> _
>
> Jesse Graupmann
> www.jessegraupmann.com
> www.justgooddesign.com/blog/
> _
>
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Merrill,
> Jason
> Sent: Monday, July 16, 2007 10:23 AM
> To: flashcoders@chattyfig.figleaf.com
> Subject: RE: [Flashcoders] Arguments.callee._name?
>
> Slight typo in my last example, try this:
>
> import mx.utils.Delegate
>
> var oRel:Object = myButton_mc.onRelease = Delegate.create(this,
> myButtonMethod)
> var oRol:Object = myButton_mc.onRollOver = Delegate.create(this,
> myButtonMethod)
> oRel.name = "onRelease"
> oRol.name = "onRollOver"
>
> function myButtonMethod():Void
> {
>trace(arguments.caller.name)
> }
>
> Basically you are assigning the delegate to an object, and then tacking
> on a custom property to the object.
>
> Curious though, why you need to do this?
>
> Jason Merrill
>
> ___
> 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] Arguments.callee._name?

2007-07-16 Thread Jesse Graupmann
For variety sake, here is a simple alternative.


mx.events.EventDispatcher.initialize ( mc );

handleEvent ( mc, 'onPress' );
handleEvent ( mc, 'onRelease' );
handleEvent ( mc, 'onReleaseOutside' );

mc.addEventListener ( 'onPress', mx.utils.Delegate.create ( this,
eventHandler ) )
mc.addEventListener ( 'onRelease', mx.utils.Delegate.create ( this,
eventHandler ) )
mc.addEventListener ( 'onReleaseOutside', mx.utils.Delegate.create ( this,
eventHandler ) )

function handleEvent ( obj:Object, event:String ) 
{
obj [ event ] = function(){this.dispatchEvent ({type:event,
target:this }) }
}

function eventHandler ( evt:Object ) 
{
trace( evt.type + '\t\t\t' + evt.target );
}



_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Merrill,
Jason
Sent: Monday, July 16, 2007 10:23 AM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] Arguments.callee._name?

Slight typo in my last example, try this:

import mx.utils.Delegate

var oRel:Object = myButton_mc.onRelease = Delegate.create(this,
myButtonMethod)
var oRol:Object = myButton_mc.onRollOver = Delegate.create(this,
myButtonMethod)
oRel.name = "onRelease"
oRol.name = "onRollOver"

function myButtonMethod():Void
{
trace(arguments.caller.name)
}

Basically you are assigning the delegate to an object, and then tacking
on a custom property to the object.

Curious though, why you need to do this?

Jason Merrill

___
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] onPress events from within a Class

2007-07-08 Thread Jesse Graupmann

"One way is to create a MyButton clip in the library and attach a class 
to it." - Ricky | Good Angel


"Instead of Delegate, use the Proxy class from Person13.com.  It will make
you happy." - Adam | Bad Angel

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

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


RE: [Flashcoders] XML loading and parsing problem

2007-07-08 Thread Jesse Graupmann
Muzak, we all know you bought stock in Delegate back in the day - you're
just protecting your assets. I'm still curious what the Delegate tattoo
looks like... 

;)


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Sunday, July 08, 2007 3:57 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] XML loading and parsing problem

>
> The OP was reporting a problem and many people seemed to suggest that
Delegate was going to help solve the problem, something that 
> was entirely erroneous.
>

I mentioned Delegate in response to this piece of code (posted by Fruber):

gallery.onLoad = function( bSuccess ) { if ( bSuccess ) fun( this ); };
fun( xmlInfo:XML ):Void
{
 // perform your XML stuff.
}

And then Omar asked:
Muzak... why Delegate??

regards,
Muzak 


___
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] XML loading and parsing problem

2007-07-08 Thread Jesse Graupmann
Look Ma! No Delegate



///


var scope = this;
var callback = "xml_parse";

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = xml_loaded;
xmlData.load ( "gallery.xml" );

function xml_loaded( success:Boolean )
{   
if ( success ) scope [ callback ] ( this ); 
}

function xml_parse ( xml:XML ) 
{
var total = xml.firstChild.firstChild.childNodes.length;
trace ( this + "xml_loaded :: total: " + total );
}


///


xmlData = new XML();
xmlData.scope = this;
xmlData.ignoreWhite = true;
xmlData.onLoad = function ( success:Boolean ) 
{ 
if ( success ) this.scope.xml_parse ( this ); 
}

xmlData.load ( "gallery.xml" );

function xml_parse ( xml:XML )
{
var total = xmlData.firstChild.firstChild.childNodes.length;
trace ( this + "xml_loaded :: total: " + total );
}


///



Event Dispatcher


///


xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = function ( success:Boolean )
{ 
this.dispatchEvent ( { target:this, type:"xml_onLoad",
success:success } )
}
mx.events.EventDispatcher.initialize ( xmlData );
xmlData.addEventListener ( "xml_onLoad", this );
xmlData.load ( "gallery.xml" );

function xml_onLoad ( evt:Object ) {
var xml = evt.target;
var total = xmlData.firstChild.firstChild.childNodes.length;
trace ( this + "xml_loaded :: total: " + total );
}


///



Or, sorta Delegate style...


///


function createAndLoadXML ( path:String, scope:Object, callback:Function )
{
var func = function ( success:Boolean )
{
this.onLoad = null; // clear some memory?
var scope = arguments.callee.scope;
var callback = arguments.callee.callback;
callback.call ( scope, this, success );
}

func.scope = scope;
func.callback = callback;
func.xml = new XML();
func.xml.ignoreWhite = true;
func.xml.onLoad = func;
func.xml.load ( path );
}

function xml_parse ( xml:XML, success:Boolean )
{
var total = xml.firstChild.firstChild.childNodes.length;
trace ( this + "xml_loaded :: total: " + total );
}

createAndLoadXML ( "gallery.xml", this, xml_parse );



_

Jesse Graupmann
www.jessegraupmann.com   
www.justgooddesign.com/blog/  
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Andrews
Sent: Sunday, July 08, 2007 12:22 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] XML loading and parsing problem

Best practice, fine. Only practice, no.

> regards,
> Muzak

Paul 

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

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


RE: [Flashcoders] XML loading and parsing problem

2007-07-07 Thread Jesse Graupmann


Introduction to XML in Flash
http://www.kirupa.com/web/xml/index.htm



Textbook example...



xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = mx.utils.Delegate.create ( this, xml_onLoad );
xmlData.load ( "gallery.xml" );

function xml_onLoad  ( success:Boolean )
{
if ( success ) xml_loaded (); else trace( 'nada' );
}

function xml_loaded () 
{
var total = xmlData.firstChild.firstChild.childNodes.length;
trace ( "xml_loaded :: total: " + total ); // 4
}




_____

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Omar Fouad
Sent: Saturday, July 07, 2007 4:45 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] XML loading and parsing problem

something else missing

-- 
Omar M. Fouad - Digital Emotions
http://www.omarfouad.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


RE: [Flashcoders] SEO Question

2007-07-07 Thread Jesse Graupmann
http://labs.blitzagency.com/?p=171 
http://labs.blitzagency.com/?p=51


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dave
Mennenoh
Sent: Saturday, July 07, 2007 10:11 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] SEO Question

We're developing a site in Flash - it's all Flash - one page, and I'm now 
tasked with doing some SEO work for it. I'm doing the 'standard' way of 
creating the HTML portion, for the spiders, with a div that is overwritten 
by SWFObject. Mostly all is well, ad much of my content is database driven. 
My question is in regards to the fact the Flash is all on one page - 
index.php. However, I need multiple pages in the HTML version... what's the 
best way to do this? Embed the Flash on all pages as well? Not care and just

have multiple php/html pages? My feeling is I should have the Flash on all 
pages too, and just use a url var to bring up the correct content, if Flash 
is viewable... Just want to be sure the best route here.


Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ 

___
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: AW: [Flashcoders] Turn image around effect?

2007-06-30 Thread Jesse Graupmann

You could totally do it with magic. ;)


http://lab.andre-michelle.com/bitmap-particles-2
http://lab.andre-michelle.com/bitmap-particles


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Zeh Fernando
Sent: Saturday, June 30, 2007 1:32 PM
To: Rákos Attila; flashcoders@chattyfig.figleaf.com
Subject: Re: AW: [Flashcoders] Turn image around effect?


No need to look for crazy, magical features to pull the trick.


Zeh


___
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] gotoAndPlay Problem (replaying a nested clip)

2007-06-29 Thread Jesse Graupmann

Click to start from frame 1 and play till frame 36.
Click again at anytime to start from frame 36 and play to the end.

--

init ( btn );

function init ( $:MovieClip )
{
  var _ = this;
  $.frameOff = 1;
  $.frameOn = 36;
  $.onPress = function()
  {
this.swapDepths ( 1000 );
if ( this.isOpen ) _.close ( this ); else _.open ( this );
  }
}

function open ( $:MovieClip )
{
  $.isOpen = true;
  destinationFrame ( $, 1, $.frameOn );
}

function close ( $:MovieClip )
{
  $.isOpen = false;
  destinationFrame ( $, $.frameOn, $._totalframes );
}

function destinationFrame ( $:MovieClip, startFrame:Number, endFrame:Number
)
{
  startFrame = Math.max( 1, Math.min ( $._totalframes, startFrame ) );
  endFrame = Math.max( 1, Math.min ( $._totalframes, endFrame ) );

  $.gotoAndStop ( startFrame );
  $.onEnterFrame = function()
  {
if (( endFrame - $._currentframe) < 0 ) $.prevFrame(); else
$.nextFrame();
if ( $._currentframe == endFrame )
{
  delete $.onEnterFrame;
}
  }
}

_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul V.
Sent: Friday, June 29, 2007 12:49 PM
To: Flash Coders
Subject: [Flashcoders] gotoAndPlay Problem (replaying a nested clip)

pressNum=0;  // toggle variable

page.p9.onPress = function(){
this.swapDepths(1);  

 if(pressNum !=1){openPlay(this);}
 else{closePlay(this);} 
}

function openPlay(p){
 pressNum =1;   
 p.gotoAndStop(1);   
 p.gotoAndPlay("start");  //start is 2nd frame
}

function closePlay(p){   
p.gotoAndPlay(36);   //36 center frame
pressNum =0;
}

Vdst.

___
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: AW: [Flashcoders] Turn image around effect?

2007-06-29 Thread Jesse Graupmann
If you check the code they are using bitmap classes from
http://www.group94.com/. Ask em about com.group94.graphics.TransformImage.
It looks like its using triangles and texture bitmapFills.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matthias
Dittgen
Sent: Friday, June 29, 2007 3:50 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: AW: [Flashcoders] Turn image around effect?

have you tried to contact their developer directly? ;-)

2007/6/29, Peter Oliver Geller <[EMAIL PROTECTED]>:
> But when you use the image distortion effect (Bitmap Data)
> with a two image flip, it´s tricky to program your mask on the point of
> intersection where the image turns around, because on that moment you
> display the front and backside and I think group94 use another type of
> technique which is definitely easier.
>
> Hmm or you can really simple do a gradient alpha flow on the two images in
> an inversely direction?
>
> Thanks
> Peter
>
> -Ursprüngliche Nachricht-
> Von: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Im Auftrag von Cedric
> Muller
> Gesendet: Freitag, 29. Juni 2007 11:40
> An: flashcoders@chattyfig.figleaf.com
> Betreff: Re: AW: [Flashcoders] Turn image around effect?
>
> maybe by creating the illusion of only one image that is front and
> back ??
> My guess is that there are two images flipped in the same time: one
> from visible to invisible and the other one from invisible to visible
>
> hth,
> Cedric
>
> > I know the card flip effect,
> > but I think its more like the effect Jesse Graupmann posted.
> >
> > The question is how ja shows the image backside???
> > I have no idea how to combine the image distortion to switch from
> > front to
> > backside and vice versa?
> >
> > Any ideas?
> >
> > Peter
> >
> > -Ursprüngliche Nachricht-
> > Von: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] Im Auftrag von
> > Pedro
> > Taranto
> > Gesendet: Donnerstag, 28. Juni 2007 19:37
> > An: flashcoders@chattyfig.figleaf.com
> > Betreff: Re: [Flashcoders] Turn image around effect?
> >
> > Card Flip Effect:
> > http://pixelfumes.blogspot.com/2006/07/business-card-flip-effect-
> > class-with.
> > html
> >
> > --Pedro Taranto
> >
> >
> > Peter Geller escreveu:
> >> Hi list,
> >>
> >>
> >>
> >> can somebody give me an answer how this turn around effect was
> >> made when
> >> you click on the speech bubble?
> >>
> >>
> >>
> >> http://www.ja-ik-doe-mee.be/
> >>
> >>
> >>
> >> Or is it done with a visual flatted 3D Image made with
> >> http://www.flashsandy.org/ ?
> >>
> >>
> >>
> >>
> >>
> >> Another nice technique which interests me is used on this side:
> >>
> >> http://lab.mathieu-badimon.com/ same technique?
> >>
> >>
> >>
> >> Maybe some of you have a link for me how this is done?
> >>
> >>
> >>
> >> Thanks a lot
> >>
> >>
> >>
> >> Peter
> >>
> >> ___
> >> 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://chattyfi

RE: [Flashcoders] Turn image around effect?

2007-06-28 Thread Jesse Graupmann
http://www.reflektions.com/miniml/template_permalink.asp?id=344


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Peter Geller
Sent: Thursday, June 28, 2007 11:29 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Turn image around effect?

Hi list,

 

can somebody give me an answer how this turn around effect was made when
you click on the speech bubble?
http://www.ja-ik-doe-mee.be/

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

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


RE: [Flashcoders] How can I keep some MovieClips always on top?

2007-06-28 Thread Jesse Graupmann
You can create an instance at the topmost depth, but then swap them to a
target depth using something like setAtDepth...


function setAtDepth ( mc, depth )
{
//  SET MC TO DEPTH
//  -   will push all other instances down in depth if
conflicting

// depths will be based on parent
var p = mc._parent;

// ERROR || NO PARENT
if ( p == undefined ) return;

// get instance currently at depth
var instance = p.getInstanceAtDepth ( depth );

// set out of the way to not disturb other mcs
instance.swapDepths ( p.getNextHighestDepth() );

// put into place
mc.swapDepths ( depth );

// push movieClips down till there are none left
while ( instance != undefined )
{
// decrease the depths
depth --;

// get next instance
var nInstance = p.getInstanceAtDepth ( depth );

// swap depths
instance.swapDepths ( depth );

// set previous instance
instance = nInstance;
}
}




I came up with this little gem after finding a hack for removeMovieClip()'s
negative depth issue.




function safelyRemoveClip ( mc:MovieClip ):Void
{
//  CLIPS ON THE TIMELINE USUALLY HAVE A NEGATIVE DEPTH AND ARE
NOT AFFECTED BY REMOVECLIP.
//  THIS IS A QUICK HACK

var mcTemp:MovieClip = mc._parent.getInstanceAtDepth(0);
mc.swapDepths(0);
mc.removeMovieClip();
if(mcTemp != undefined)
{
mcTemp.swapDepths(0);
}
}



_____

Jesse Graupmann
www.jessegraupmann.com
www.justgooddesign.com/blog/  
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kannan
Bharadwaj
Sent: Tuesday, June 26, 2007 11:46 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] How can I keep some MovieClips always on top?

I need to maintain certain movieclips always on top. I have been using
getNextHighestDepth() in creating these movieclips. One option is to specify
the depth for these alone to be very close at the point of their creation.
However, am not sure if mixing getNextHighestDepth() for some MCs and hard
coding for some others is the best way to do this.

Appreciate if anyone can suggest a better way..

 

Thanks

Kannan

 




Kannan Bharadwaj

SolutionSpace

Email: [EMAIL PROTECTED]

URL: www.solution-space.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


RE: [Flashcoders] wordpress and flash integration

2007-06-25 Thread Jesse Graupmann
Tim Wilson just released this article;

Flash To WordPress Guide and Code
http://tvwonline.net/flash/#page_id=44&article=60
"Today I will make available some of the PHP code I wrote to extract Data
from WordPress in an XML format. I have also created a diagram and
explanation on how my website works to hopefully assist anyone else who
wants to try the same thing.

Press Connect
http://tvwonline.net/lab/pressconnect/ 
"PressConnect is a PHP Script I have developed for use with my Flash
Website. It is a PHP Script which interigates a WordPress Database and
Returns POSTS, PAGES, and CREATES MENUS in an XML format."


_____

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rostislav
Hristov
Sent: Saturday, March 17, 2007 12:13 PM
To: [EMAIL PROTECTED]; flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] wordpress and flash integration

There're different ways to make this happen.

Check out this nice Flash/Wordpress integration:
http://tvwonline.net/flash/#page_id=44&article=35 


On 3/17/07, Glen Pike <[EMAIL PROTECTED]> wrote:
> Hi Kerem.
>
> It depends what you want to "parse".
>
> You could use the RSS feed as a way of getting data into Flash as it
> is XML, which Flash can deal with very easily.
>
> If you want to talk to the database more directly, you will have to
> consider using Flash Remoting - have a look to see if anyone has created
> an AMFPHP - server side code for Flash Remoting in PHP - plugin for
> Wordpress.
>
> http://amfphp.org/
>
>
>
http://www.google.co.uk/search?hl=en&q=flash+remoting&btnG=Google+Search&met
a=
>
<http://www.google.co.uk/search?hl=en&q=flash+remoting&btnG=Google+Search&me
ta=>
>
> HTH
>
> Glen
>
> Kerem İşeri wrote:
> > Hi everyone...
> >
> >
> >
> > I am starting a new project, it will be my first trial on the subject..
I
> > thought that I could use wordpress as a database for contents and
pictures
> > for my site.
> >
> > It will be so cool if I can make it, because I will get rid of the
coding on
> > php and admin panel of this project, wordpress has a very userfriendly
admin
> > interface it self built in. Anyways,
> >
> > Anybody tried this before ? or does anybody know how can I parse
wordpress
> > pages for the flash?
> >
> >
> >
> > Thanks a lot.
> >
> >
> >
> > Kerem.

___
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] loading xml into flash in spanish(desperate)

2007-06-25 Thread Jesse Graupmann
Using Macromedia Flash MX as a multilingual authoring tool
http://www.adobe.com/support/flash/languages/flashlocalization/


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gustavo
Duenas
Sent: Monday, June 25, 2007 11:50 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] loading xml into flash in spanish(desperate)

I'm still stuck on this... would somebody help me, I don't know why  
this flash apparently doesn't want to read the xml from the attributes,
I changed the xml into utf-8 and nothing, I also set up _sans in the  
css and nothing, does anyone knows how can I finally convince this  
flash to show my spanish characters as ñ and the é(tildes)...thanks  
Everyhting is ok, but the spanish characters. this is quite  
disturbing because I speak spanish.


Gustavo
this is my code:


stop();




menus = new XML();

menus.ignoreWhite = true;

menus.onLoad = function(success)
{

var target = _root.screenTxt.myText_txt1;
var holder = _root.menu;

var titleMenus = this.firstChild.childNodes.length;
var menuContent = this.firstChild;

for (var i = 0; i < titleMenus; ++i )
{

var depth = holder.getNextHighestDepth();
var btn = holder.attachMovie( "buttons", 'btn_' + i , depth
);

btn._x = 0;
btn._y = -10 * i * 4;

btn.data = {
text: menuContent.childNodes[i].attributes.text,
title: menuContent.childNodes[i].attributes.title
};


btn.poa.text = btn.data.title;
btn.onRelease = function(){

target.html=true;
target.htmlText =""+
this.data.title+"" +"" +
""+this.data.text+"";

}

}

}

menus.load("txt/poa.xml");


this is the xml

___
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] Scroll Bar formula problem

2007-06-25 Thread Jesse Graupmann
Using 4 movieClips; mask, content, handle, scrollbar


handle.onPress = mx.utils.Delegate.create ( this, startScroll );
handle.onRelease = handle.onReleaseOutside = mx.utils.Delegate.create (
this, stopScroll );

function startScroll()
{
var l = scrollbar._x;
var t = scrollbar._y;
var r = scrollbar._x;
var b = scrollbar._y + scrollbar._height - handle._height;
handle.startDrag (false, l, t, r, b );
onEnterFrame = scrollPer;
}

function stopScroll()
{
handle.stopDrag();
}

function scrollPer()
{
var t = scrollbar._y;
var b = scrollbar._y + scrollbar._height - handle._height;
var per = ( handle._y - scrollbar._y ) / ( b-t );
setScrollPer( per );
}

function setScrollPer( per )
{
var t = mask._y;
var b = mask._y + mask._height - content._height;
var dY = ((b - t)*per) + t;
content._y = dY;
}



_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of O. Fouad
Sent: Monday, June 25, 2007 1:15 AM
To: Flashcoders mailing list
Subject: [Flashcoders] Scroll Bar formula problem

Hi, I can't figure out how I can move a masked MC according to the position
of the scroll bar.

I tried this code with a scrollbar a mask and MC (the content)

yp = scrollbar._y;
scrollRatio = MC._height/mask._height;

scrollbar._height = mask._height/scrollRatio; //gets the height of the
scrollbar ;


left = scrollbar._x;
top = scrollbar._y
right = scrollbar._x;
bottom = (mask._x + mask._height) - scrollbar._height;

this.onEnterFrame = function () {
//here is the formula i tried

MC._y = (-scrollbar._y+ yp) / scrollRatio; // for sure this is
incorrect!!!
}
scrollbar.onPress = function () {
startDrag(this, false, left,top,right,bottom);
}
scrollbar.onRelease =  function () {
this.stopDrag();
}
scrollbar.onReleaseOutside =  function () {
this.stopDrag();
}
// end of code


With this code the intial position of the MC isn't like the one it is
supposed to be, and the scrollbar isnt srcolling the MC entirely...

can any ne help???


Best Regards..


-- 
O.Fouad
___
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] Lightbox & Flash & .mov

2007-06-20 Thread Jesse Graupmann
Various versions... not sure which does the trick.


ThickBox
http://jquery.com/demo/thickbox/  

LightWindow
http://stickmanlabs.com/lightwindow/  

SWFBox
http://blog.codefidelity.com/?p=10   

SlimBox
http://www.digitalia.be/software/slimbox/ 

GreyBox
http://orangoo.com/labs/GreyBox/ 

LightBox
http://www.huddletogether.com/projects/lightbox/


_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Carl Welch
Sent: Wednesday, June 20, 2007 2:53 PM
To: Flashcoders mailing list
Subject: [Flashcoders] Lightbox & Flash & .mov

I have a client who wants to play quictime .mov (does not want .flv)
files in a lightbox.js type thing called from Flash. I found
FlashLightBox but it won't pay quicktime files. Does anyone know or
has seen anything like this out there in the world?

-- 
Carl Welch
http://www.carlwelch.com
[EMAIL PROTECTED]
805.403.4819


___
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] Mouse Velocity?

2007-06-20 Thread Jesse Graupmann

var mouse_obj = { 
nx:null, ny:null, ox:null, oy:null,
velx:0, vely:0, mov:0, target:_root,
init: function( $target )
{
with ( this )
{
target = $target;
nx = ox = target._xmouse;
ny = oy = target._ymouse;
velx = vely = mov = 0;
}
},
update: function()
{
with ( this ) 
{
ox = nx
oy = ny
nx = target._xmouse;
ny = target._ymouse;
velx = nx - ox;
vely = ny - oy;
mov = Math.sqrt((velx*velx) + (vely*vely));
}
}
};

onMouseDown = function()
{
mouse_obj.init( _root );
this.onEnterFrame = function()
{
mouse_obj.update();

trace ( 'velx: ' + mouse_obj.velx )
trace ( 'vely: ' + mouse_obj.vely )
trace ( 'mov: ' + mouse_obj.mov + newline )
};
}

onMouseUp = function()
{
this.onEnterFrame = null;
}

_____

Jesse Graupmann
www.jessegraupmann.com  
www.justgooddesign.com/blog/  
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of eric e.
dolecki
Sent: Wednesday, June 20, 2007 10:29 AM
To: Flashcoders mailing list
Subject: [Flashcoders] Mouse Velocity?

I am calculating mouse velocity, but every now and then you get a 0 for
velocity eventhough its not 0 (setInterval prob I suspect).  Any better
approach?

var MouseX;
var MouseY;

function determineVelocity():Void
{
MouseX = _root._xmouse
MouseY = _root._ymouse
setTimeout( calc, 9 );
};

setInterval( determineVelocity, 20 );

function calc():Void
{
var newMouseX:Number = _root._xmouse;
var newMouseY:Number = _root._ymouse;

var deltaX = Math.abs(MouseX - newMouseX)
deltaY = Math.abs(MouseY - newMouseY)
dist = Math.sqrt((deltaX * deltaX) + (deltaY * deltaY))
velocity = dist*31; // 31 = fps
trace( velocity );
};


___
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] Grid / Math - getting neighbouring positions

2007-06-20 Thread Jesse Graupmann
Here is my stab at it... 



function getGridRing( $r:Number, $c:Number, dist:Number, minRow:Number,
minCol:Number, maxRow:Number, maxCol:Number ):Array 
{
//  @   $r = start row
//  @   $c = start column
//  @   dist = destination ring
trace( 'row: ' + $r + '  col: ' + $c + ' ring: ' + dist);

//  length of ring
var len = ( dist * 2 ) + 1;

//  error check for single point
if ( len <= 1 ) return [{row:$r, col:$c}]; else var array = []; 

//  return only values in bounds [ optional ]
var inBounds = function ( r, c ) 
{   
if(!isNaN(minRow)) {if ( minRow > r ) return false;}
if(!isNaN(minCol)) {if ( minCol > c ) return false;}
if(!isNaN(maxRow)) {if ( maxRow < r ) return false;}
if(!isNaN(maxCol)) {if ( maxCol < c ) return false;}
return true;
}


//  TOP
for ( var i = 0; i < len ; i++ ) 
{
var c = $c - dist + i
var r = $r - dist;
if( inBounds( r,c )) array.push ({row:r, col:c })
}

//  RIGHT
for ( var i = 1; i < len; i++ ) 
{
var c = $c + dist;
var r = $r - dist + i;
if( inBounds( r,c )) array.push ({row:r, col:c })
}

//  BOTTOM
for ( var i = 1; i < len; i++ ) 
{
var c = $c + dist - i
var r = $r + dist;
if( inBounds( r,c )) array.push ({row:r, col:c })
}

//  LEFT
for ( var i = 1; i < len-1; i++ ) 
{
var c = $c - dist;
var r = $r + dist - i;
if( inBounds( r,c )) array.push ({row:r, col:c })
}

return array;
}

function getGridRings ( r:Number, c:Number, minR:Number, minC:Number,
maxR:Number, maxC:Number ):Array
{
var maxLen = Math.max( Math.max ( Math.abs(maxC-c), Math.abs(minC-c)
), Math.max ( Math.abs(maxR-r), Math.abs(minR-r) ) );
if ( !isNaN(maxLen) ) 
{
var array = [];
for ( var i = 0; i <= maxLen; i++ )
{
array = array.concat( getGridRing ( r, c, i, minR,
minC, maxR, maxC ) );
}
return array;
} 
return [];
}





//
//
//  SINGLE RING
//
//


var array = getGridRing ( 2, 2, 0 );
var result = '';
for ( var i in array ) { result = '[' + array[i].col + ',' + array[i].row
+'] ' + result }
trace( result + newline ) 
// [2,2]

//> [2,2]


var array = getGridRing ( 2, 2, 1 );
var result = '';
for ( var i in array ) { result = '[' + array[i].col + ',' + array[i].row
+'] ' + result }
trace( result + newline ) 
// [1,1] [2,1] [3,1] [3,2] [3,3] [2,3] [1,3] [1,2]

//> [1,1] [2,1] [3,1] 
//> [1,2] [2,2] [3,2] 
//> [1,3] [2,3] [3,3] 


var array = getGridRing ( 2, 2, 2, 0, 0, 4, 4 );
var result = '';
for ( var i in array ) { result = '[' + array[i].col + ',' + array[i].row
+'] ' + result }
trace( result + newline ) 
// [0,0] [1,0] [2,0] [3,0] [4,0] [4,1] [4,2] [4,3] [4,4] [3,4] [2,4] [1,4]
[0,4] [0,3] [0,2] [0,1] 

//> [0,0] [1,0] [2,0] [3,0] [4,0]
//> [0,1] [1,1] [2,1] [3,1] [4,1]
//> [0,2] [1,2] [2,2] [3,2] [4,2]
//> [0,3] [1,3] [2,3] [3,3] [4,3]
//> [0,4] [1,4] [2,4] [3,4] [4,4]


//
//
//  ALL RINGS
//
//

var array = getGridRings ( 2, 2, 0, 0, 4, 4 )
var result = '';
for ( var i in array ) { result = '[' + array[i].col + ',' + array[i].row
+'] ' + result }
trace( result + newline ) 
// [2,2] [1,1] [2,1] [3,1] [3,2] [3,3] [2,3] [1,3] [1,2] [0,0] [1,0] [2,0]
[3,0] [4,0] [4,1] [4,2] [4,3] [4,4] [3,4] [2,4] [1,4] [0,4] [0,3] [0,2]
[0,1] 


var array = getGridRings ( 0, 0, 0, 0, 4, 4 )
var result = '';
for ( var i in array ) { result = '[' + array[i].col + ',' + array[i].row
+'] ' + result }
trace( result + newline ) 
// [0,0] [1,0] [1,1] [0,1] [2,0] [2,1] [2,2] [1,2] [0,2] [3,0] [3,1] [3,2]
[3,3] [2,3] [1,3] [0,3] [4,0] [4,1] [4,2] [4,3] [4,4] [3,4] [2,4] [1,4]
[0,4]





_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_





-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jiri
Heitlager | dadata.org
Sent: Saturday, June 16, 2007 5:16 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Grid / Math - getting neighbouring positions

Hello list,

I have the following grid and would like to find the neighbouring 
positions of a certai

RE: [Flashcoders] Re: getBytes...() works only local, not online (except when imgs are cached)

2007-06-12 Thread Jesse Graupmann
Dear, Dear, re:Dear Helios,

When at first you don't succeed, reply to yourself. Ok, so here is something
I just stumbled across called PreloadAssetManager - but I haven't used it
yet. Probably because although Jack Doyle has been rockn' the 3k range he's
still missing the sexy examples like Papervision3D with Tweener:
http://labs.blitzagency.com/?p=314. ;)



PreloadAssetManager
An Intelligent Preloading Queue
http://blog.greensock.com/preloadassetmanageras2/ 

DESCRIPTION

Provides an easy way to invisibly preload SWFs, FLVs, or images and
optionally trigger a callback function when preloading has finished. It also
provides _width and _height information for all successfully preloaded SWFs
or images, and duration information for FLVs (assuming they were encoded
properly and have MetaData). By default, it will initially only load enough
of each asset to determine the size (bytes) of each asset so that it can
accurately report the percentLoaded_num, getBytesLoaded() and
getBytesTotal(), then it loops back through from the beginning and finishes
all the preloading. If you're not going to use a preloader status bar that
polls these methods/properties, you can just set the trackProgress_boolean
property to false to skip that initial delay.

* Compatibility: Flash Player 6 and later (ActionScript 2.0) (FLV preloading
requires Flash Player 7)
* File Size added to published SWF: About 3Kb



_____

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Helios
Pregioni Bayma
Sent: Tuesday, June 12, 2007 11:08 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Re: getBytes...() works only local,not online (except
when imgs are cached)

Hi list,

I am facing a problem I can´t solve, and since now, thanks a lot for any
help.

>
> I am loading images and preloading them...ok, nothing new.
> For this, I am using loadClip and onLoadProgress to update their
> bytesLoaded and bytesTotal, so I can preload them perfectly.
> The amount of images to load, vary according to the clicked item.
> When I try this local, works perfectly, the bytes amount are updated as it
> should, but when I try it online,
> it just doesn´t work.
>
> When I load images and they are not cached:
> getBytesLoaded returns: undefined
> getBytesTotal returns: undefined
>
> But when they finish to load, and when they start to load when already
> cached:
> getBytesLoaded returns: correct size
> getBytesTotal returns: always 0
>
> Here is the code:
>
> var mcl:MovieClipLoader = new MovieClipLoader();
> var listener:Object = new Object();
> mcl.addListener(listener);
>
> var totalLoaded = 0;
> var loaderTime = 0;
>
> function loadImagesToHolders() {
> var totalToLoad = txtImagensServicosXML[dataID1][dataID2].length;
> //totalImgsToLoad doubles cause it loads both mini and big images
> var totalImgsToLoad = totalToLoad*2;
> totalLoaded = 0;
> listener.onLoadComplete = function(mc:MovieClip):Void  {
> totalLoaded++;
>
> var id1 = mc._name.slice(5, 6);
> var id2 = mc._name.slice(7, 8);
> if (totalLoaded == totalImgsToLoad) {
>
> clientes.onEnterFrame = function() {
> if (barFullandLoaded == true) {
> this.onEnterFrame = null;
> barFullandLoaded = false;
> if (processStopped == false) {
> loader.bar.gotoAndStop(1);
> clientesLoaded();
> }
> }
> };
> }
> };
>
> //waste of code, temp used cause of old problems
> mcTotalLoaded = null;
> mcTotalSize = null;
> totalL = null;
> totalS = null;
> //end of waste of code
> var mcTotalLoaded:Array = new Array(totalToLoad);
> var mcTotalSize:Array = new Array(totalToLoad);
> var thePercent = 0;
> var barFullandLoaded = false;
> listener.onLoadProgress = function(mc:MovieClip):Void  {
> var mcID = mc._name.slice(-1);
> mcTotalLoaded[mcID] = mc.getBytesLoaded ();
> mcTotalSize[mcID] = mc.getBytesTotal();
> };
> loaderTimer = getTimer();
> loader.onEnterFrame = function() {
> totalL = 0;
> totalS = 0;
> for (var i:Number = 0; i totalL += mcTotalLoaded[i];
> totalS += mcTotalSize[i];
> }
> thePercent = Math.ceil((totalL/totalS)*100);
> if (thePercent>(loader.bar._currentframe*2) &&
> loader.bar._currentframe<50) {
> loader.bar.play();
> } else {
> load

RE: [Flashcoders] Cycle through XML nodes

2007-06-12 Thread Jesse Graupmann
As someone that doesn't read Flash help, will not do a Google search, will
never register or participate on a Flash forum, will ask the same question
enough times an re: has to be added to the beginning to keep it fresh, will
always asks the list before logically thinking through any project, let's
others do paid work for free, dials 911 about abandoned shopping carts,
prefers the title L337 over n00b, and spams technical support for site
checks... 

I take offense Jason!



[HINT] for anyone else just like me: http://www.kirupa.com/web/xml/index.htm


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Merrill,
Jason
Sent: Tuesday, June 12, 2007 9:48 AM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] Cycle through XML nodes

Was it you - or maybe someone else, but this same exact question was just
asked recently, and after several responses and the person also being
referred to Flashnewbies, the thread ended.  I suggest you ask on
Flashnewbies or refer back to the previous responses.  No offense, but this
is pretty basic stuff.

Jason Merrill
Bank of America  
GT&O Learning & Leadership Development
eTools & Multimedia Team


 

>>-Original Message-
>>From: [EMAIL PROTECTED] 
>>[mailto:[EMAIL PROTECTED] On Behalf 
>>Of José Maria Barros
>>Sent: Tuesday, June 12, 2007 12:33 PM
>>To: Flashcoders mailing list
>>Subject: [Flashcoders] Cycle through XML nodes
>>
>>Hi, all..I hope anyone can help me here..
>>
>>I have two buttons: a next and a previous button.
>>
>>I need to cycle through the XML nodes with that..
>>
>>Like a photo menu that i press next and the next photo and 
>>text loads..
>>
>>Can anyone give me hints about it?
>>
>>THanks in advance


___
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] AS2: Multilanguage-Listener

2007-06-12 Thread Jesse Graupmann
@ Cryzto "where's the practical difference between this solution and the
solution where I just tell the Buttons to do what I want"

There is nothing I could say that Muzak hasn't already said better and
repeatedly. With that, search this list on EventDispatcher, encapsulation,
and dirty ass code.

http://www.mail-archive.com/flashcoders@chattyfig.figleaf.com/msg31071.html 
http://www.mail-archive.com/flashcoders@chattyfig.figleaf.com/msg31112.html 

Hasta!


//
//  NO EVENTS
//


var main = this;
var array = [ 'de', 'fr', 'it', 'en' ];
for ( var i in array )
{
var btn = this[array[i]];
btn.onRelease =
function(){_root.lang_xml.load("conf_"+this.label.toLowerCase()+".xml");};
}


//
//  WITH EVENTS
//


var array = [ 'de', 'fr', 'it', 'en' ];
for ( var i in array )
{
var btn = this[array[i]];
mx.events.EventDispatcher.initialize( btn );
btn.addEventListener( 'click', mx.utils.Delegate.create ( this,
loadLanguage ) );
btn.onRelease = releaseHandler;
}

function releaseHandler ()
{
this.dispatchEvent({type:'click',target:this,
lang:this.label.toLowerCase() });
}

function loadLanguage ( evt:Object ) 
{
_root.lang_xml.load("conf_"+evt.lang+".xml");
}


_

Jesse Graupmann
www.jessegraupmann.com   
www.justgooddesign.com/blog/  
_




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Cristo @
cryzto.ch
Sent: Tuesday, June 12, 2007 5:34 PM
To: flashcoders@chattyfig.figleaf.com
Subject: AW: [Flashcoders] AS2: Multilanguage-Listener

@ eka: thanks but for the moment i just want to understand why my code
doesn't work... but I sure will take a look at your OpdenSource-project :-)

@ Jesse: Thanx fort he hint, I modified now my code to my needs... it works,
only: where's the practical difference between this solution and the
solution where I just tell the Buttons to do what I want
(= onRelease(
lang_xml.load("XMLFile");
updateTextfields();
))?

Here my code (it works):

this.de.onRelease = function() {
this.dispatchEvent({type:'click',target:this});
//trace("DE-Button was pressed");
}
this.fr.onRelease = function() {
this.dispatchEvent({type:'click',target:this});
//trace("FR-Button was pressed");
}
this.it.onRelease = function() {
this.dispatchEvent({type:'click',target:this});
//trace("IT-Button was pressed");
}
this.en.onRelease = function() {
this.dispatchEvent({type:'click',target:this});
//trace("EN-Button was pressed");
}
var langListener:Object = new Object();

langListener.click = function (EvtObj:Object){
var str:String = EvtObj.target.label.toLowerCase();
_root.lang_xml.load("conf_"+str+".xml");
}
for (var prop in this) {
mx.events.EventDispatcher.initialize(this[prop]);
this[prop].addEventListener("click", langListener);
//trace(this[prop]);
}

stop();

-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im Auftrag von Jesse
Graupmann
Gesendet: Dienstag, 12. Juni 2007 22:09
An: flashcoders@chattyfig.figleaf.com
Betreff: RE: [Flashcoders] AS2: Multilanguage-Listener

You have to initialize the object before you can add listeners;


var listener:Object = new Object();

listener.click = function ( evt:Object)
{
trace("it worked!");
};

var obj:Object = new Object();

mx.events.EventDispatcher.initialize ( obj );

obj.addEventListener( "click", listener );

obj.dispatchEvent ( {type:'click', target:obj } );


_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Cristo @
cryzto.ch
Sent: Tuesday, June 12, 2007 12:45 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] AS2: Multilanguage-Listener

Hi everybody

 

I'm working on a multilanguage configurator and want to update every
textareas, labels etc. by clicking on one of the available lang-buttons
(english, german, spanish ect.).

 

My configurator consists of different movieclips/layers of course. Now I've
tried to reach this by creating an evenlistener on those buttons, but
without success.

 

Code (layer: _level0):

 

var langListener:Object = new Object();

langListener.click = function (EvtObj:Object){

trace("it worked!");

};

// ie: english-button

_level0.langP_mc.en_btn.addEventListener("click", langListener);

 

 

Can anyone help?

 

Cryzto


No virus found in this outgoing message

RE: [Flashcoders] AS2: Multilanguage-Listener

2007-06-12 Thread Jesse Graupmann
You have to initialize the object before you can add listeners;


var listener:Object = new Object();

listener.click = function ( evt:Object)
{
trace("it worked!");
};

var obj:Object = new Object();

mx.events.EventDispatcher.initialize ( obj );

obj.addEventListener( "click", listener );

obj.dispatchEvent ( {type:'click', target:obj } );


_____

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Cristo @
cryzto.ch
Sent: Tuesday, June 12, 2007 12:45 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] AS2: Multilanguage-Listener

Hi everybody

 

I'm working on a multilanguage configurator and want to update every
textareas, labels etc. by clicking on one of the available lang-buttons
(english, german, spanish ect.).

 

My configurator consists of different movieclips/layers of course. Now I've
tried to reach this by creating an evenlistener on those buttons, but
without success.

 

Code (layer: _level0):

 

var langListener:Object = new Object();

langListener.click = function (EvtObj:Object){

trace("it worked!");

};

// ie: english-button

_level0.langP_mc.en_btn.addEventListener("click", langListener);

 

 

Can anyone help?

 

Cryzto


No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.472 / Virus Database: 269.8.14/845 - Release Date: 12.06.2007
06:39
 
___
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] another stupid XML question

2007-06-09 Thread Jesse Graupmann
So I gave you links to loading, parsing, and querying - all that is left is
creating.

Create and Edit XML in Flash
http://www.kirupa.com/developer/actionscript/create_edit_xml.htm


_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ben deroo
Sent: Saturday, June 09, 2007 11:10 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] another stupid XML question

let me rephrase the question then:
when I click a button, i want xml1.xml to be loaded
when I click another button, i want xml1.xml to be replaced with xml2.xml

thx
Ben

___
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] another stupid XML question

2007-06-09 Thread Jesse Graupmann

//
//  USING ONLOAD
//


Loading XML Into Flash
http://www.kirupa.com/web/xml/XMLwithFlash3.htm 

BadassXML
http://www.mosessupposes.com/utilities/index.html

This is very odd, but... if you want to replace xml with another xml:

my_xml = new XML();
function loadXML1 (){
my_xml = new XML();
my_xml.onLoad = loadXML1_loaded;
my_xml.load("data1.xml");
}
function loadXML2 (){
my_xml = new XML();
my_xml.onLoad = loadXML2_loaded;
my_xml.load("data2.xml");
}

function loadXML1_loaded ( success ){
{
if (success)trace(this);
}

function loadXML2_loaded ( success )
{
if (success)trace(this);
}


//
//  USING XPATH
//


But maybe you want to load a single xml and query parts of it - enter XPath.

Using XPath
http://www.informit.com/articles/article.asp?p=169633&rl=1  

XPath – by xfactor
http://www.xfactorstudio.com/ 



//
//  USING XML2OBJECT
//


XML2Object
http://www.sephiroth.it/file_detail.php?id=129 


I think Attila is right in saying you need to not worry about changing the
xml, but rather how you use the data. In order for you to do that, you need
to convert ( parse ) the xml into a useable object. Then get the information
you need from that object.

Start by making an object that is like the xml;

obj = {
concept: [ {path: "images/a1.jpg", br:413, ho:550,
thumbpath:"thumbnails/a1.jpg", thumbwidth:56,thumbheight:75 },
  {path: "images/vue.jpg", br:550, ho:309,
thumbpath:"thumbnails/vue.jpg", thumbwidth:56,thumbheight:75 } ],
details: [ {path: "images/a1.jpg", br:413, ho:550,
thumbpath:"thumbnails/a1.jpg", thumbwidth:56,thumbheight:75 },
  {path: "images/a2.jpg", br:550, ho:413,
thumbpath:"thumbnails/a2.jpg", thumbwidth:56,thumbheight:75 } ]
}

Then access parts of your information when needed;

var array = obj.concept;
for ( var i = 0; i < array.length; i++ ){
var thumbData = array [i];
var path = thumbData.path;
trace( 'concept path: ' + path );
}

var array = obj.details;
for ( var i = 0; i < array.length; i++ ){
var thumbData = array [i];
var path = thumbData.path;
trace( 'details path: ' + path );
}

Once you get your thumbnails working, you can go back to the xml and work on
parsing it into that object above. You can try your own parser, or the handy
XML2Object - everything after this is just logic.


_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ben deroo
Sent: Saturday, June 09, 2007 11:10 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] another stupid XML question

let me rephrase the question then:
when I click a button, i want xml1.xml to be loaded
when I click another button, i want xml1.xml to be replaced with xml2.xml

thx
Ben

On 6/9/07, Rákos Attila <[EMAIL PROTECTED]> wrote:
>
>
> You are the only one who may know how to remove the thumbnails from
> the stage, since you are the only one who knows how did you created
> them, stored their references, etc. Your question is totally
> independent of XML, it's a matter of basic scripting and movieclip
> handling.
>
>   Attila
>
> bd> hi,
> bd> small sample:
> bd>  
> bd> 
> bd>  bd> "thumbnails/a1.jpg" thumbwidth="56" thumbheight="75">
> bd>  bd> "thumbnails/vue.jpg" thumbwidth="56" thumbheight="75">
> bd> 
> bd> 
> bd>  bd> "thumbnails/a1.jpg" thumbwidth="56" thumbheight="75">
> bd>  bd> "thumbnails/a2.jpg" thumbwidth="56" thumbheight="75">
> bd> 
> bd> 
> bd>
> bd>
> bd>
> bd> I'd like to be able to load and /or replace sections of this xml file.
> bd>
> bd> meaning:
> bd> when I click a button on stage, i'd like thumbnails(that code has
> allready
> bd> been done) to appear from the  node.
> bd> when I click another button on stage, i'd like that content to be
> removed
> bd> (deleted from the stage, but not from the xml file ofcourse) and be
> replaced
> bd> by content from the  node.
> bd>
> bd> yup, I feel stupid, but that's ok!
> bd>
> bd> Ben

___
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] Having MovieClip behaviors in a class..

2007-06-08 Thread Jesse Graupmann
I'm not saying you have to create a new instance but was just getting as
close to your example as I could, which looks like a new instance to me;

"var myBox:DrawBox("boxname");
myBox._y = 100;
myBox._alpha = 50;"

" this is just an example..
u know i wanted to apply some custom effect to a movieClip and using
mc.applyFX(bla bla) instead of applyFX(mc, bla bla);
Just like mc_tween's mc.alphaTo() for example..."

If you want shortcuts like mc_tween then you are probably attaching them to
the MovieClip prototype. This will give every MovieClip from there on out
the same functions ( version1 ).

If you want and instance by instance basis with shortcuts, then you can try
using a class like EventDispatcher.initialize ( object ), or replace a
simple MovieClip with a class that extends the MovieClip class which
includes those shortcuts you want ( version2 ).

You'll notice in version2 each shortcut calls static methods in another
class. Maybe that keeps file size and memory usage down... who knows?



/
//
//  VERSION 1: Prototype Approach 
//
/


var mc = this.createEmptyMovieClip ( 'box', this.getNextHighestDepth() );
MovieClip.prototype.OFouction = function(){ trace( 'this function is
special' ) };
mc.OFouction (); // this function is special




/
//
//  VERSION 2: Shortcuts with static methods
//
/


//  In .fla


var myBox = this.createEmptyMovieClip ('myBox', this.getNextHighestDepth()
);
myBox.__proto__ = DrawBox.prototype;
myBox.drawMe ();
myBox._y = 100;
myBox._alpha = 0;
myBox.alphaTo ( 100 );



//  in DrawBox.as


import CrazyEffects;
class DrawBox extends MovieClip
{
public function DrawBox ( ) {   
}

public function drawMe (  ):Void { CrazyEffects.drawBox ( this ); }
public function alphaTo ( alpha:Number ):Void { CrazyEffects.alphaTo
( this, alpha )  };
}



//  in CrazyEffects.as


class CrazyEffects
{

public function CrazyEffects ( )
{
}

public static function drawBox ( mc ):Void
{
with ( mc )
{
beginFill(0xFF,100);
moveTo(0,0);
lineTo(100,0);
lineTo(100,100);
lineTo(0,100);
lineTo(0,0);
endFill();
}
}

public static function alphaTo ( mc, alpha ):Void
{
mc.onEnterFrame = function()
{
 var dif = alpha - this._alpha;
 if ( Math.abs( dif) < 2  )
 {
 this._alpha = alpha;
 delete this.onEnterFrame;
 }
 else
 {
 this._alpha += dif / 6;
 }
}
}
}

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of O. Fouad
Sent: Friday, June 08, 2007 7:09 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Having MovieClip behaviours in a class..

thanks :D but why should i use static methods I am trying to create some
color effect shortcuti wont need to create new instances. If i  have a
movieClip on my stage i wouldlike to have it
myMC.someEffect(par);


___
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] AS2: EventDispatcher.initialize() and super()conflict?

2007-06-08 Thread Jesse Graupmann
I never use super() so I have no idea, but see what happens when you throw
the initialize in a static variable like;


class myClass extends otherClass
{
private static var EventDispatcherDependancy  =
mx.events.EventDispatcher.initialize ( myClass.prototype );
public var addEventListener:Function;
public var removeEventListener:Function;
public var dispatchEvent:Function;

public function myClass (m:Model) {
super();
}
}

_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Merrill,
Jason
Sent: Friday, June 08, 2007 4:31 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] AS2: EventDispatcher.initialize() and
super()conflict?

I have a class that has to call it's superclass in the constructor.
However, it also needs to initialize EventDispatcher to listen to
dispatch events that another class is listening to.  It seems, and I
could be wrong, that EventDispatcher does not work if it's not the first
thing in the constructor.  I thought someone had said once, or I read
it, that EventDispatcher has to be first in the constructor.  And of
course, probkem then is super() will not work if it's not first, so it
seems to be a catch-22.  Is this true regarding
EventDispatcher.initialize() and how to avoid?

code snippet:

   /*=Constructor=*/
public function MyClass(m:Model)
{
super(m);
EventDispatcher.initialize(this);
}

If this is OK then maybe something else is wrong in my code, I just
wanted to find out if maybe this is why the events aren't firing.  

Thanks,


Jason Merrill
Bank of America  
GT&O Learning & Leadership Development
eTools & Multimedia Team

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

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


RE: [Flashcoders] Having MovieClip behaviours in a class..

2007-06-08 Thread Jesse Graupmann
Or try static methods...


//
//  IN FLA
//


var myBox:DrawBox = DrawBox.newBox ( "boxname", _root );
myBox._y = 100;
myBox._alpha = 50;


//
//  IN DrawBox.as
//


class DrawBox extends MovieClip 
{

public function DrawBox ( )
{
}

public static function newBox ( boxname, boxtarget ):DrawBox
{

var mc = boxtarget.createEmptyMovieClip ( boxname,
boxtarget.getNextHighestDepth());
mc.__proto__ = DrawBox.prototype;
mc.INIT ();
return mc;
}

private function INIT()
{
with ( this )
{
beginFill(0xFF,100);
moveTo(0,0);
lineTo(100,0);
lineTo(100,100);
lineTo(0,100);
lineTo(0,0);
endFill();
}
}
}



_____

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Glen Pike
Sent: Friday, June 08, 2007 3:58 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Having MovieClip behaviours in a class..

Hi,
   
If you are extending a movie-clip, why can't you just draw in there??

e.g.

class DrawBox extends MovieClip {

  public function drawBox() {
   beginFill(0xFF,100);
   moveTo(0,0);
   lineTo(100,0);
   lineTo(100,100);
   lineTo(0,100);
   lineTo(0,0);
   endFill();
   }
}

attachMovie("DrawBox", "myBox", 1);

myBox.drawBox();

myBox._y = ...

HTH

Glen
   

O. Fouad wrote:
> Ok, this is just frustrating me... somebody help me please :(
>
> i've got this class DrawBox that as it says, draws a box on the stage..
>
> class DrawBox extends MovieClip {
>var myMC:MovieClip;
>
>public function DrawBox(boxName:String) {
>this.myMC =
> _root.createEmptyMovieClip(boxName,_root.getNextHighestDepth());
>this.myMC.beginFill(0xFF,100);
>this.myMC.moveTo(0,0);
>this.myMC.lineTo(100,0);
>this.myMC.lineTo(100,100);
>this.myMC.lineTo(0,100);
>this.myMC.lineTo(0,0);
>this.myMC.endFill();
>}
> }
>
> this works so fine and in fact i've got a 100x100 red box on my stage, 
> and i
> thought that extending MovieClip, this class, should get the same 
> behaviours
> of a MovieClip like this:
>
> var myBox:DrawBox("boxname");
> myBox._y = 100;
> myBox._alpha = 50;
>
> but desperately it doesnt work as in the box alpha and y doesnt change...
>
> is there something Missing?
> 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


RE: [Flashcoders] EventDispatcher weirdness in AS2

2007-06-07 Thread Jesse Graupmann
The alternative to creating a variable as the subscriber is to use an
extended Delegate class - one that either stores the variable inside the
function or appends it to the end of the arguments.


Appends:

http://dynamicflash.com/2005/02/delegate-class-refined/


Usage:

import mx.controls.TextArea;
import com.dynamicflash.utils.Delegate;

class DFDelegateTest {
  private var _textArea:TextArea;

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

  private function onTextAreaChange(event:Object, delegate:Function) : Void
{
trace("DFDelegateTest.onTextAreaChange");
_textArea.removeEventListener("change", delegate);
  }
}



Stores variable: 

http://www.justgooddesign.com/blog/jgdelegate.htm


Usage:

import mx.controls.TextArea;
import com.jgraup.utils.jgDelegate2;

class DFDelegateTest {
  private var _textArea:TextArea;

  public function DFDelegateTest(textArea:TextArea) {
_textArea = textArea;
_textArea.addEventListener("change", jgDelegate2.create(this,
onTextAreaChange));
  }

  private function onTextAreaChange(event:Object ) : Void {
trace("DFDelegateTest.onTextAreaChange");
_textArea.removeEventListener("change", arguments.callee.self );
  }
}



_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of James E.
Booth Jr.
Sent: Thursday, June 07, 2007 9:45 AM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] EventDispatcher weirdness in AS2

Another thing to note:

Delegating the event as such:
_dg.addEventListener("change", Delegate.create(this,
datagridChangeHandler));

will NOT allow you to remove the event listener.

This won't work:
_dg.removeEventListener("change", Delegate.create(this,
datagridChangeHandler));


What I usually do is have a private variable:

private var datagridChangeHandler_func

and then create the delegate:

datagridChangeHandler_func = Delegate.create(this, datagridChangeHandler);

Thany you would add and remove it as:

_dg.addEventListener("change", datagridChangeHandler_func);

_dg.removeEventListener("change", datagridChangeHandler_func);

- James

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Muzak
Sent: Thursday, June 07, 2007 12:22 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] EventDispatcher weirdness in AS2


Even though it's possible to use the class instance as the listener (this),
you're still better off using Delegate.
What if you have 2 instances dispatching the same event that need to be
handled completely different?

submit_btn.addEventListener("click", this);
aTotallyUnrelated_btn.addEventListener("click", this);

The above will work, but they'll both trigger the same event handler and
you'll have to resort to if()else() stuff.
No big deal if you have 2 buttons.. get's hairy with loads of buttons.
Or what about different components (DataGrid, ComboBox, List, etc..) who all
dispatch a "change" event..

_dg.addEventListener("change", this);
_cb.addEventListener("change", this);
_list.addEventListener("change", this);

versus:

_dg.addEventListener("change", Delegate.create(this,
datagridChangeHandler));
_cb.addEventListener("change", Delegate.create(this, comboChangeHandler));
_list.addEventListener("change", Delegate.create(this, listChangeHandler));

Get in the habit of using Delegate (in AS2) and *always* use it.. no
exceptions ;-)

regards,
Muzak

- Original Message -
From: "Alain Rousseau" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, June 07, 2007 4:07 PM
Subject: RE: [Flashcoders] EventDispatcher weirdness in AS2


> Hehe no prob.
>
> For your listener are you doing something like
>
> _myClass.addEventListener("onTransition", Delegeate.create(this,
> onTransitionHandler));
>
> private function onTransitionHandler() {
> //do stuff
> }
>
> don't you prefer
>
> _myClass.addEventListener("onTransition", this);
>
> function onTransition() {
> //do stuff
> }
>
> for better clarity and less code writing ? No need of delegate in this
case.
>
> Of course it's a question of choice and habit. Just to let you know of the
> alternatives !
>
> Alain
>


___
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://ww

RE: [Flashcoders] MovieClips and levels

2007-06-06 Thread Jesse Graupmann
Dave, 

You can work around the problem by attaching a MovieClip and passing enough
information to the newly created clip to make a simple copy. It's not
perfect and depending on how complicated your clip is, you might want to
try;

var copy = copyMovieClip ( mc, mc, 'box', 'copy' );
copy.initializeCopy ();


You get the idea...


 
//  ORIGINAL

var mc = this.attachMovie ( 'box', 'mc', this.getNextHighestDepth() );
mc._x = 50
mc._y = 50
mc.prop = 'this is a prop'


//  COPY

var copy = copyMovieClip ( mc, mc, 'box', 'copy' );


//  FUNCTION

function copyMovieClip ( mc, newParent, linkageID, newName ) 
{
var ini = {
_x: mc._x,
_y: mc._y,
_width: mc._width,
_height: mc._height,
_xscale: mc._xscale,
_yscale: mc._yscale
}
for(var i in mc) ini[i]=mc[i];

var newmc = newParent.attachMovie ( linkageID, newName,
newParent.getNextHighestDepth(), ini );
return newmc;   
}


//  OUTPUT 

trace( 'mc: ' + mc )
for(var i in mc) trace('\tmc.' + i + ' = ' + mc[i]);
trace( '\ncopy: ' + copy )
for(var i in copy) trace('\tcopy.' + i + ' = ' + copy[i]);


//

mc: _level0.mc
mc.prop = this is a prop
    mc.copy = _level0.mc.copy

copy: _level0.mc.copy
copy.prop = this is a prop



_

Jesse Graupmann
www.jessegraupmann.com   
www.justgooddesign.com/blog/  
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Cohn
Sent: Wednesday, June 06, 2007 9:18 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] MovieClips and levels

Patrick,

Thanks-- that's what I thought.
I'd actually tried Bitmaps first, but they weren't working for me in  
this case...

Time to move on to CS3!

Thanks again,
--Dave



> No.   You can make a bitmap copy then attachBitmap.
>
> I'd suggest getting into Flash CS3 and/or Flex.  Goodbye to the old
> movieclip levels.  It was so difficult to manage.
>
> Cheers
> Patrick
> On Jun 5, 2007, at 6:13 PM, David Cohn wrote:
>
>> Hey all,
>>
>> Is there a way to "transfer", or copy, a movieClip between levels?
>> I'd like to do something like:
>>  
>>  var mc = somelevel.createEmptyMovieClip(..);
>>  
>> ...and then have the root be able to access it:
>>
>>  _root.copyMovieClip( mc ) or _root.attachMovieByReference( mc )
>>  
>> ...is this possible?  Or am I overlooking something simple?
>>
>> Thanks,
>> --Dave

___
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] thumbnail panel

2007-06-05 Thread Jesse Graupmann
//
//
//  VERSION 1
//
//


var xspace = 20;
var yspace = 20;
var xmax = 400;
var row = 0;
var col = 0;
var len = 10;

for ( var i = 0; i < len; i ++ ) 
{
var depth = this.getNextHighestDepth();
var t = this.attachMovie ( "box", "box_" + i, depth );

var nx = ( t._width + xspace ) * col;
if ( nx > xmax )
{
col = 0;
++row;
nx = ( t._width + xspace ) * col;
}

var ny = ( t._height + yspace ) * row;
++col;

t._x = nx;
t._y = ny;
}



//
//
//  VERSION 2
//
//


var xspace = 20;
var yspace = 20;
var width = xspace + 30;
var height = yspace + 30;
var rows = 5;
var len = 10;

for ( var i = 0; i < len; i ++ ) 
{
var depth = this.getNextHighestDepth();
var t = this.attachMovie (  "box", "box_" + i, depth );
var col = (i % rows);
var row = (Math.floor( i/rows ));
t._x = width * col;
t._y = height * row;
}


_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ben deroo
Sent: Monday, June 04, 2007 5:39 PM
To: Flashcoders mailing list
Subject: [Flashcoders] thumbnail panel

hi,
I'm trying to create a simple sample thumbnail panel with movieclips, which
i'll later modify, but there seems to be something wrong in the code


code:
//
for (var i:Number = 0; i<10; i++) {
var t = attachMovie("box", "box"+i, i+1);
var Xspacing:Number = 20;
var Xreset:Number = 0;
var Yspacing:Number = 20;
var counter:Number = 1;

t._x += (t._width+Xspacing)*i;

if (t._x>400) {
//counter++;
t._y = (t._height+Yspacing);
t._x = Xreset;
t._x += (t._width+Xspacing)*(counter);
} else {
//counter++;
}
}


//end code

I'm trying to create several rows, but seem to be failing to do so, is this
a conditional logic error?

thanks for any help


Ben
___
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] [OT] - FYI - tabletop computing video

2007-06-03 Thread Jesse Graupmann

Since Surface will only support WPF and not Flash, that doesn't mean you
can't build your own for under $500
http://www.lumenlab.com/forums/index.php?showtopic=17532&st=0 

Then get some Flash AS3 code to play around with
http://nuigroup.com/log/comments/touchlib_flash_clients/
http://www.benchun.net/flosc/
http://www.merl.com/projects/dtflash/


--


Microsoft Surface
http://www.microsoft.com/surface/

Surface Links
http://www.justgooddesign.com/blog/microsoft_surface.htm 

Multitouch Links
http://www.justgooddesign.com/blog/multi-touch-surface-computing-iphone-game
-on.htm 

Other Interactive Table Links
http://tecfa.unige.ch/perso/staf/nova/blog/2005/01/10/space-and-place-a-list
-fo-interactive-tables/




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of nik crosina
Sent: Sunday, June 03, 2007 1:57 PM
To: Flashcoders mailing list
Subject: [Flashcoders] [OT] - FYI - tabletop computing video

http://www.popularmechanics.com/technology/industry/4217348.html

Nik C

___
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] AS 2 Delegate question

2007-06-02 Thread Jesse Graupmann
So is this still out of the question... 



///
/// IN FLA
///

var box = this.attachMovie ( 'box', 'box',  this.getNextHighestDepth() );

jgButton.initializeMovieClip ( box );
box.data = 'this is my data';

box.showEvents( 'onPress', 'onRollOver' );
box.addEventListener ( 'onPress', mx.utils.Delegate.create( this,
onButtonEventHandler ) );
box.addEventListener ( 'onRollOver', mx.utils.Delegate.create( this,
onButtonEventHandler ) );
function onButtonEventHandler ( evt:Object ) 
{ 
trace( newline );
trace ( 'target: ' + evt.target ) 
trace ( 'type: ' + evt.type ) 
trace ( 'data: ' + evt.target.data ) 
}


///
/// IN jgButton.as
///



class jgButton extends MovieClip
{
private static var EventDispatcherDependancy  =
mx.events.EventDispatcher.initialize( jgButton.prototype );
private static var jgButtonTypes:Object = {
onRollOut: 0,
onRollOver: 0,
onPress: 0,
onRelease: 0,
onReleaseOutside: 0,
onDragOut: 0,
onDragOver: 0
};
private var addEventListener:Function;
private var removeEventListener:Function;
private var dispatchEvent:Function;
private var dispatchQueue:Function;

public function jgButton (){}


///  STATIC  ///


public static function initializeMovieClip ( mc:MovieClip ):Void
{
// replace MovieClip class with jgButton class
mc.__proto__ = jgButton.prototype;
}



///  PUBLIC  ///

///
/// LISTENERS
///

public function showEvents (  )
{
if ( arguments.length == 0 )
{
//
//  SHOW ALL
//
for ( var type in jgButtonTypes )
{
if ( !jgButtonTypes [ type ] )
{
jgButtonTypes [ type ] = 1;
this [ type ] = jgButtonEvent ( type
);
}
}
}
else
{
for ( var i in arguments )
{
var type:String = arguments[ i ];

if ( !jgButtonTypes [ type ] )
{
jgButtonTypes [ type ] = 1;
this [ type ] = jgButtonEvent ( type
);
}
}
}
}

public function hideEvents ( )
{
if ( arguments.length == 0 )
{
//
//  DELETE ALL
//
for ( var type in jgButtonTypes )
{
if ( jgButtonTypes [ type ] )
{
jgButtonTypes [ type ] = 0;
delete this [ type ];
}
}
}
else
{
for ( var i in arguments )
{
var type:String = arguments [ i ];

if ( jgButtonTypes [ type ] )
{
jgButtonTypes [ type] = 0;
delete this [ type ];
}
}
}
}



///  PRIVATE  ///


///
/// EVENT FUNCTION
///

private function jgButtonEvent ( type:String )
{
return function()
{
var evt = {};
evt.type = type;
evt.target = this;
    this.dispatchEvent ( evt );
}
}
}





_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Saturday, June 02, 2007 5:54 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] AS 2 Delegate question

This isn't about quick and easy, but about encapsulation, OOP and best
practices.
Quick and easy also often means quick and dirty ;-)

Here's a

RE: [Flashcoders] AS 2 Delegate question

2007-06-02 Thread Jesse Graupmann
Ha! That's rad. 

I guess the trick is writing a Flash app to write the bulk of the code...
Got links to any of those? 

;)


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Saturday, June 02, 2007 5:54 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] AS 2 Delegate question

This isn't about quick and easy, but about encapsulation, OOP and best
practices.
Quick and easy also often means quick and dirty ;-)

Here's a stripped down version of a custom button.

import mx.events.EventDispatcher;
import mx.utils.Delegate;

class com.muzakdeezign.samples.MyButton extends MovieClip {
 // decorate class with EventDispatcher
 private static var dispatcherInit =
EventDispatcher.initialize(com.muzakdeezign.samples.MyButton.prototype);

 // declare EvenDispatcher methods
 public var addEventListener:Function;
 public var removeEventListener:Function;
 public var dispatchEvent:Function;

 private var back_mc:MovieClip;

 private var __index:Number;

 function MyButton() {
  this.init();
 }

 private function init():Void {
  this.back_mc.onRelease = Delegate.create(this, this.backReleaseHandler);
 }

 private function backReleaseHandler():Void {
  this.dispatchEvent({type:"click"});
 }

 private function setIndex():Void {
 }

 function get index():Number {
  return this.__index;
 }
 function set index(val:Number):Void {
  this.__index = val;
  this.setIndex();
 }

}

Here's a screencast making the above:
http://muzakdeezign.com/flashcoders/create_component/MyButton.html

regards,
Muzak


- Original Message - 
From: "Jesse Graupmann" <[EMAIL PROTECTED]>
To: 
Sent: Sunday, June 03, 2007 1:43 AM
Subject: RE: [Flashcoders] AS 2 Delegate question


> Muzak,
>
> You bring this up every time proxy is mentioned. Do you mind sharing an
> actual code example that is just as quick and easy?
>
> Hasta,
> Jesse


___
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] AS 2 Delegate question

2007-06-02 Thread Jesse Graupmann
Muzak,

You bring this up every time proxy is mentioned. Do you mind sharing an
actual code example that is just as quick and easy? 

Hasta,
Jesse


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Saturday, June 02, 2007 2:53 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] AS 2 Delegate question

Create a custom Button component that has public methods and properties that
you can access.
Have your custom Button dispatch a click event, just like the v2 Button
component does.

Others might suggest to use a Proxy class that lets you pass extra
parameters, I'd suggest not to do so.

Simply create your own Button and you'll have all the power you need.

regards,
Muzak

- Original Message - 
From: "Stefano Nappa" <[EMAIL PROTECTED]>
To: 
Sent: Saturday, June 02, 2007 5:33 PM
Subject: [Flashcoders] AS 2 Delegate question


>
> Hi, a question.
>
>
> I'm talking about AS 2.
>
> Inside a method of a class I've:
>
>
>
> btnCollection.onRollOver = Delegate.create(this,
btnRollOver(btnCollection));
> after having built this method:
>
> private function btnRollOver(whichBtn) {
>var t = Number(whichBtn._name.substr(1, 1));
>//
>Mouse.hide();
>//
>cursor._visible = true;
>startDrag(cursor, true);
>//
>setRotation(curPos[t]);
>}
>
>
> nothing works like before.
>
>
> That is: I probably easily get the class reference but I've lost the
> reference to the single button...
>
> I even tried (with no results):
>
> 1. btnCollection.onRollOver = Delegate.create(this,
> btnRollOver, btnCollection);
>
> 2. changing btnCollection to be a class variable (not a local one);
>
> Please, can you help me better understand this issue? What am I doing
wrong?
>
> 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] Need help creating an old-skool arc or circularscrollbar

2007-05-23 Thread Jesse Graupmann

Trigonometry
http://www.codylindley.com/Tutorials/trigonometry/

Trig Tutorial
http://www.albinoblacksheep.com/flash/trig





-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ash Warren
Sent: Wednesday, May 23, 2007 9:58 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Need help creating an old-skool arc or
circularscrollbar

A lng time ago it seems these things were all over flashkit etc. and now
well not so much ;)

Anyway, I wanted to create a scroller on an arc or radius like this example:

http://s12987.gridserver.com/arc_scroller_example.jpg

Can anyone point me in the right direction to create something like this?  I
have no problem coding a simple single-axis scrollbar but have been having
problems with this one trying to keep it on the curved track.

Thank you so much in advance.

___
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] Fwd: Timeline label question

2007-05-23 Thread Jesse Graupmann
"Colin Moock's book Essential ActionScript 2.0 - page 288 - set2/#6
6. At frames 4 and 15 of the labels layer, add a new keyframe."

"Colin Moock's book Essential ActionScript 2.0 - page 288 - set3/#1&2
1. At frame 5 of the scripts layer, add a new keyframe
2. With frame 5 of the scripts layer selected, enter the following code
if (_framesloaded == _totalframes){ gotoAndStop ("main" ); } else {
gotoAndPlay ( "loading" ); } "

The actions for frame 1 only ran once, when you were on frame 1. You may
have access to any variables created then, but 'overlapping' doesn't call
those each time you step onto frame 4.

Going to frame 4 is a way to put a delay of one frame between the next check
on frame 5 - kind of like waiting a bit before asking "are we there yet?"

 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Andy Herrman
Sent: Wednesday, May 23, 2007 7:30 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Fwd: Timeline label question

I haven't seen the book so this is completely a guess, but is it
possible he wants the actions in frame 1 to happen before the loading
display (maybe some pre-loading initialization) but the actions in
frame 5 need to happen after the loading display has been shown?

  -Andy

On 5/22/07, Jeff Chadwell <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I saw something in Colin Moock's book Essential ActionScript 2.0 and I was
> wondering if someone could explain it.
>
> In Chapter 11, he outlines an OOP application framework.  In the part
where
> he sets up the timeline in the .fla file, he attaches actions on frames 1,
5
> and 15 (these frames are also keyframes).  However, the "loading" label
> starts on frame 4 so it actually overlaps the actions associated with
frame
> 1.
>
> My questions:
>
> 1.  Why doesn't he start the "loading" label on frame 5 to correspond to
the
> actions that start on that frame?
>
> 2.  What is the effect of starting the label on frame 4 instead of frame
5?
>
> Jeff Chadwell
>
> --
> When everyone is against you, it means that you are absolutely wrong-- or
> absolutely right.  -- Albert Guinon
> ___
> 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] Q:Create and animate diagonal slices from Bitmap

2007-05-23 Thread Jesse Graupmann


Any suggestions eh...?

This is not perfect at all but I think works fine as a quick test and only
using a 45 degree rotation. 

To see it working, put any image in a MovieClip and call it 'mc' and then
this code on the same frame.


-



Stage.scaleMode = 'noScale' 
import flash.display.*
import flash.geom.*


function drawSlices ( image:MovieClip, drawMC:MovieClip, rotation:Number,
sliceWidth:Number ) 
{
var slice_info = getSliceInfo ( image, rotation );

// DOT IS JUST A VISUAL MARKER
dot._x = image._x + slice_info.pt.x;
dot._y = image._y + slice_info.pt.y;
dot.swapDepths ( dot._parent.getNextHighestDepth() )

var angle = rotation * (Math.PI/180);

var slices_top = Math.ceil(image._width/sliceWidth);
var slices_bottom = Math.ceil((slice_info.pt.x)/sliceWidth)

var slice_array = [];
for ( var i = -slices_bottom; i < slices_top; i++ ) 
{
var slice = drawMC.createEmptyMovieClip ( 'slice_' + i,
drawMC.getNextHighestDepth() );
slice._x = i * ( sliceWidth-(sliceWidth/1.7));

var bmp_temp = new BitmapData ( sliceWidth+1,
slice_info.diagonal_height+sliceWidth, true, 0x00FF );
var bmp_temp_matrix:Matrix = new Matrix();
bmp_temp_matrix.rotate( angle );

bmp_temp_matrix.translate( -(sliceWidth) * i, -sliceWidth *
i );
bmp_temp.draw ( image, bmp_temp_matrix, null, null, null,
true );

var slice_bmp = new BitmapData ( slice_info.diagonal_width ,
slice_info.diagonal_height, true, 0x00FF );
var slice_bmp_matrix:Matrix = new Matrix();
slice_bmp_matrix.rotate(-angle);
slice_bmp_matrix.translate( (sliceWidth )*i, 0 );

slice_bmp.draw ( bmp_temp, slice_bmp_matrix, null,
null,null, true  );
slice.attachBitmap ( slice_bmp, 1, true, true );

slice_array.push ( slice );
}
drawMC.slice_array = slice_array;
}




function getSliceInfo ( image, angle)
{
var pt = new Point ( image._width, image._height );
var len = pt.length;

var degrees = 90 - angle;
var radians = degrees * (Math.PI/180);  

var dpt = new Point ( len * Math.cos ( radians ), len * Math.sin (
radians ) );

dpt.x = Math.max ( 0, Math.min ( pt.x, dpt.x ));
dpt.y = Math.max ( 0, Math.min ( pt.y, dpt.y ));

var info = {
pt:dpt,
diagonal_width: dpt.x,
diagonal_height: dpt.length
}
return info;
}




function drawSlicedImage ()
{   
// ORIGINAL IMAGE
mc._alpha = 40

//  SLICE HOLDER
var drawMC = this.createEmptyMovieClip ( 'drawMC',
this.getNextHighestDepth() );
drawMC._x = mc._x;
drawMC._y = mc._y;

//  CREATE SLICES
var sliceWidth = 30
var angle = 45;
drawSlices ( mc, drawMC, angle, sliceWidth );
}

function addSliceInteraction ( )
{
drawMC.onMouseMove = function() 
{
var xper = Math.max ( 0, Math.min ( 1, this._xmouse /
mc._width ) )
var yper = 1-Math.max ( 0, Math.min ( 1, this._ymouse /
mc._height ) )
var per = (xper+yper)/2
var inx = Math.round ( this.slice_array.length * per  )
for ( var i in this.slice_array  ) 
{
var slice = this.slice_array [ i ];
if ( i == inx ) 
{
slice._alpha = 10;
} 
else 
{
slice._alpha = 100;
}
}
}
}


//


function INIT () 
{
drawSlicedImage ();
addSliceInteraction ();
}

INIT ();



_____

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_





-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, May 22, 2007 11:38 AM
To: flashcoders
Subject: [Flashcoders] Q:Create and animate diagonal slices from Bitmap

I'm trying to create and animate diagonal slices from a bitmap object.

The easiest way to create slices from Bitmaps is via the Rectangle class,
but I need diagonal slices.

Can this be done via a matrix transform of my bitmap BEFORE I create my
slices, or si there an easier way tha

RE: [Flashcoders] Extends Array ???

2007-05-22 Thread Jesse Graupmann
eturn ArrayUtils.sortArray ( this );
}
}

///// in ArrayUtils.as

class ArrayUtils
{
public function ArrayUtils  () {
}

public static function sortArray (array:Array )
{
var a = [].concat ( array );
a.sort();
return a;
}
}


_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Stepanenko,
Nikolai A.
Sent: Tuesday, May 22, 2007 4:34 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Extends Array ???

Has anyone been able to get the indexer working by extending Array
class?

Like

Myclass extends Array
{
... Constructor and Other needed elements
}

!!! Usage I am looking for:

Myclass[index]

One of the properties of the prototype is length. It actually gets set
on Myclass during extension of Array but I haven't figure out how to set
the index to respond with at least internal value. Ultimately I would
like to use this in static mode as an actual type.

So this would be in some way custom prebuilt array.

Any other alternatives are appreciated, thank you!

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

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


RE: [Flashcoders] help with a menu in xml

2007-05-22 Thread Jesse Graupmann
Your problem might be that your buttons are sharing the same scope when
attempting to access individual variables. When you do something like:
_root.screenTxt.myText_txt1.text=menuTitle+":"+textMenu; each button points
to the last variable you created in the loop.

By attaching the data to the button, you can access individual information
using 'this' inside the function.

I haven't tested this, but it looks better to me...


menus = new XML();
menus.ignoreWhite = true;
menus.onLoad = function(success)
{

var target = _root.screenTxt.myText_txt1;
var holder = _root.menu;

var titleMenus = this.firstChild.childNodes.length;
var menuContent = this.firstChild;

for (var i = 0; i < titleMenus; ++i )
{

var depth = holder.getNextHighestDepth();
var btn = holder.attachMovie( "buttons", 'btn_' + i , depth
); 

btn._x = 0; 
btn._y = -10 * i * 4; 

btn.data = { 
text: menuContent.childNodes[i].attributes.text,
title: menuContent.childNodes[i].attributes.title 
};


btn.poa.text = btn.data.text;
btn.onRelease = function(){
target.text = this.data.title + ":" +
this.data.text;
}

}

}

menus.load("txt/poa.xml");



_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gustavo
Duenas
Sent: Tuesday, May 22, 2007 1:20 PM
To: Flashcoders mailing list
Subject: [Flashcoders] help with a menu in xml 

Hi coders, this is thread is the second part of the other.

well I have the buttons created and I have this onRelease behavior  
attached to a every single button,
but when I tried to read into a text field part of the xml(text) this  
one only reads one, not the others and when I traced them , they are  
there(in the output window) but not into the field as they are  
supposed to.

This is my code in as2 again:

stop();




menus = new XML();
menus.ignoreWhite = true;
menus.onLoad = function(success) {
//portfolioTag = this.firstChild;
titleMenus = this.firstChild.childNodes.length;
menuContent = this.firstChild;



for (var i = 0; i < 4; i++){
// either "menu" or "item"
menuContent.childNodes[i].nodeName;
// name of the item
menuTitle= menuContent.childNodes[i].attributes.title;
var buttonsMenu= _root.menu.attachMovie("buttons", menuTitle, 10+i);
buttonsMenu._x=0;
buttonsMenu._y=-10*i*4;
var newText = buttonsMenu.poa.text=menuTitle;
// action of the item


textMenu= menuContent.childNodes[i].attributes.text;
trace(textMenu);
buttonsMenu.onRelease = function(){
_root.screenTxt.myText_txt1.text=menuTitle+":"+textMenu; // loads  
good but only one, the rest appears not to be there:(
};

}


}

menus.load("txt/poa.xml");



and this is xml















Gustavo Duenas
Creative Director
LEFT AND RIGHT SOLUTIONS LLC
1225 W. Beaver St. Suite 119
Jacksonville, Fl.  32204
904 . 2650330
www.leftandrightsolutions.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] remove duplicate items in array

2007-05-22 Thread Jesse Graupmann
You have it, just decrease the i after any splice.



function removeArrayDuplicates ( array:Array ) 
{
var a:Array = [].concat ( array );
a.sort();

for ( var i = 0; i < a.length; i++ )
{
if ( a[ i ] == a[ i + 1 ] ) a.splice ( --i + 1, 1 );
}
return a;
}


var array = [ 'a', 'a', 'b', 'c', 'a', 'b', 'b', 1, 5, 1, 2, 3, 1, 'AA',
'AA' ];

trace( 'array before: ' + array );

var arrayAFTER = removeArrayDuplicates ( array );

trace( 'array after: ' + arrayAFTER );



_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Allandt
Bik-Elliott (Receptacle)
Sent: Tuesday, May 22, 2007 10:05 AM
To: flashcoders
Subject: [Flashcoders] remove duplicate items in array

hi guys

i'm looking for a way of removing duplicate items in an array

i've done this so far

//sort array so all items of the same content are grouped together
myArray.sort();

//loop through items, removing any sitting next to a duplicate
for (var i:Number = 0; i < myArray.length; i++) {
if (myArray[i] == myArray[i+1]) {
myArray.splice (i, 1);
}
}

however, i always seems to end up with the first 2 items in the array  
being the same (although it works well after that)

i can't figure out why - hope you can help

obie

___
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] bouncing ball

2007-05-19 Thread Jesse Graupmann

Maybe something in here could help...


Collision detection & bouncing part 3: bouncing balls
http://www.johanvanmol.org/content/view/45/37/

Detecting Collisions Between Any Point of Two Movieclips
http://www.flash-creations.com/notes/astb_bounceCollide.php

Ball vs arc
http://www.tonypa.pri.ee/vectors/tut12.html

Bounding circle computation
http://lab.polygonal.de/2007/02/17/bounding-circle-computation/ 

Create a flash draw game like Line Rider or others - A different approach -
Part 2
http://www.emanueleferonato.com/2007/04/21/create-a-flash-draw-game-like-lin
e-rider-or-others-a-different-approach-part-2/

Source Code: Shape-based Hit Detection in 8
http://www.gskinner.com/blog/archives/2005/10/source_code_sha.html 

BitmapData.hitTest
http://algorithmist.wordpress.com/2007/05/06/bitmapdatahittest/

Camera Interaction with Flash
http://www.gskinner.com/blog/archives/2006/11/camera_interact.html

Collision detection with Recursive Dimensional Clustering
http://lab.polygonal.de/articles/recursive-dimensional-clustering/ 

2-Dimensional Collisions
http://www.geocities.com/vobarian/2dcollisions/




_____

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Waseem
Shahzad
Sent: Saturday, May 19, 2007 6:11 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] bouncing ball

Hello everybody;

I want to know that is it possible to bounce a ball in an irregular shaped
object's virtual boundaries.
Please help.
Thanx to all;
chand
___
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] RGB tinting using the colorMatrixFilter()

2007-05-10 Thread Jesse Graupmann


function rgbToMatrix ( r, g, b, a ) 
{
var matrix:Array = new Array();
matrix = matrix.concat([r, 0, 0, 0, 0]); // red
matrix = matrix.concat([0, g, 0, 0, 0]); // green
matrix = matrix.concat([0, 0, b, 0, 0]); // blue
matrix = matrix.concat([0, 0, 0, a, 0]); // alpha
return matrix;
}
var matrix = rgbToMatrix ( 1, 1, 0, 100 );
var filter = new flash.filters.ColorMatrixFilter ( matrix );
mc.filters = [ filter ];


or


function hexToMatrix ( hex, alpha ) 
{
var matrix:Array = [];
matrix = matrix.concat([((hex & 0x00FF) >>> 16)/255, 0, 0, 0, 0]);
// red
matrix = matrix.concat([0, ((hex & 0xFF00) >>> 8)/255, 0, 0, 0]); //
green
matrix = matrix.concat([0, 0, (hex & 0x00FF)/255, 0, 0]); // blue
matrix = matrix.concat([0, 0, 0, alpha/100, 0]); // alpha
return matrix;
}
var matrix = hexToMatrix ( 0x44DAFF, 100 );
var filter = new flash.filters.ColorMatrixFilter ( matrix );
mc.filters = [ filter ];




_____

Jesse Graupmann
www.jessegraupmann.com   
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mike
Mountain
Sent: Thursday, May 10, 2007 2:40 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] RGB tinting using the colorMatrixFilter()

not sure I made myself clear - given a desaturated greyscale image I need to
be able to tint it to an RGB value - so black stays black, white stays white
and rgb=128,128,228 (50% grey) is the actual colour - with all the shade in
between. I need to be able to do this by using code like this:

[as3]
trace("composite startTime:"+getTimer());
// tint
var matrix:Array = new Array();
matrix = matrix.concat([r1, r2, r3, r4, r5]);
matrix = matrix.concat([g1, g2, g3, g4, g5]);
matrix = matrix.concat([b1, b2, b3, b4, b5]);
matrix = matrix.concat([a1, a2,a3, a4, a5]);
var tintFilter = new ColorMatrixFilter(matrix);
[/as3]

so how do I work out the r's g's and b's in the matrix?

Cheers

Mike

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

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


RE: [Flashcoders] Syntax for dynamically calling a function

2007-05-04 Thread Jesse Graupmann

My personal favorite is the use of the Delegate loaded with arguments.



//
//  INTERACTION
//


function button_onPress ( btn:MovieClip ) 
{
var data = dataArray [ btn.id ];
var func = this [ 'func_' + data.section ];

func ( data );
}


//
//  EVENTS
//


function func_work ( data:Object ) {trace( data.btn );  }
function func_portfolio ( data:Object ) {   trace( data.id );   }
function func_about ( data:Object ) {   trace( data.section );  }


//
//  UTILS
//


function proxyBEFORE (s:Object, func:Function):Function
{
// from jgDelegate.as
var a:Array = arguments.slice(2, arguments.length);
return function ():Void { func.apply(s, a.concat(arguments));   };
}


//
//  INIT
//


var dataArray = [ {section:'work'}, {section:'portfolio'}, {section:'about'}
];

var len = dataArray.length;
for ( var i = 0; imailto:[EMAIL PROTECTED] On Behalf Of Alistair
Colling
Sent: Friday, May 04, 2007 8:59 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Syntax for dynamically calling a function

Wow, thanks for all your suggestions guys, Lists, I really appreciate  
the time you took to write your detailed response, I like your third  
option the best. David thanks for your suggestion I am going to do  
some further experimentation. I'll also have a look into the Event  
Dispatcher class as this looks interesting but I'm not sure what  
specific benefits it brings me here, I will do more research to find  
out. For the moment I think I will stick with putting this code  
inside my movie clip, and the do_ functions on the main timeline:

this.onPress = function(){
this._parent["do_" + this._name].call();
}
//
Thanks again everyone :)


On 3 May 2007, at 17:59, Lists wrote:

> The short answer is, you can invoke the function directly by writing:
>
> this.onPress = function () {
> _parent[this._name]();
> }
>
> or, if this looks clearer, you can use the call() method
>
> this.onPress = function () {
> _parent[this._name].call();
> }
>
> However, there are a few issues with this approach.
>
> First, I don't like the fact that there are two things with the  
> same name in
> the same scope: a function and a movie clip. This might just be me  
> being
> picky, but I'll show you an example of where this breaks in a moment.
>
> Second, it's not best practice to put scripts inside movie clips. It's
> easier to assign these functions from the main timeline.
>
> Third, I'm not sure what this gains you. It's easier to copy and  
> paste but,
> if you're already going into the movie clip manually, you might as  
> well just
> type the function name. Maybe if you reused the clip from movie to  
> movie
> this step would already be done and you'd only have to write the  
> function...
> Or maybe I'm missing another time saving purpose.
>
> Combining all three of the above issues, you can automatically assign
> functions to all your movie clips from the the main timeline by  
> writing
> this:
>
> (assumes mcs on stage named "pictures", "help", and "home", and  
> gets around
> same-name-in-same-scope by adding a "do_" prefix to the function name)
>
> //
> for (var s:String in this) {
> if (typeof(this[s]) == "movieclip") {
> this[x].onPress = function () {
> this._parent["do_" + this._name].call();
> }
> }
> }
> function do_pictures() {
> trace("pictures");
> }
> function do_help() {
> trace("help");
> }
> function do_home() {
> trace("home");
> }
> //
>
> This will cause EVERY mc in the main timeline to behave this way,  
> so this
> approach may not be what you want, but it's a proof of concept. You  
> could do
> this through an array of all mcs you want the function assigned to,  
> or even
> do it manually like this:
>
> pictures.onPress = function () {
> this._parent["do_" + this._name].call();
> }
>
> But, again, without some sort of automation in applying the script,  
> you lose
> the benefit. You might as well just write:
>
> pictures.onPress = function () {
> do_pictures();
> }
>
> If you want to see an example of the same-name-in-same-scope  
> problem, run
> the first example above after removing "do_" from everything. The  
> script
> will "work" but when it goes through and assigns the onPress event  
> handler,
> it will assign it to the function pictures rather than the mc  
> pictures. The
> function is seen before the mc in the execution order of the loop.
>
> Finally, if the lowercase string "movieclip" for typeof is  
> confusing, you
> can substitute:
>
> if (this[x] instanceof MovieClip) {

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

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


RE: [Flashcoders] How to call a global method like "trace"--not theclass method?

2007-04-28 Thread Jesse Graupmann
"Out" - by Big Space Ship
http://labs.bigspaceship.com/blog/?p=28

"...it does make it a lot easier to scan through large volumes of trace()
output and find the information you're looking for by formatting it nicely.
This means that every line traced out is prefixed with the classname of the
instance executing the trace, as well as the type of event the trace is
intended to represent. There's also the option of filtering the outputs such
that only traces from specific classes or of specific types are displayed."



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of eka
Sent: Saturday, April 28, 2007 12:33 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] How to call a global method like "trace"--not
theclass method?

Hello :)

Try this code :

class Debug
{


   static public function trace(str:String):void { .. }

   static public function initialize()
   {
  _global.WRITE = Debug.trace ;
   }

}

/// in your code... first in your application :

Debug.initialize() ;

// now you can use the 2 solutions to debug your application :

Debug.trace( "hello world" ) ;

or

_global.WRITE( "hello world" ) ;

EKA+ :)




2007/4/28, Douglas Pearson <[EMAIL PROTECTED]>:
>
> We have a class used in a lot of code that has a "trace" method in it:
>
> class Debug {
> public function trace(str:String):void { .. }
> }
>
> Now we'd like to call the regular "trace" method from within that class,
> but
> all of our efforts call to the class's trace method.
>
> In C++ you use "::" to indicate a global method so it would be ::trace().
>
> Is there anyway to do something similar in ActionScript?  Obviously, we
> could rename our method to something else but that would mean changing a
> lot
> of existing code.
>
> Thanks,
>
> Doug
>
> ___
> 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] Clear Set Interval Q:

2007-04-27 Thread Jesse Graupmann
I got to thinking... 

The problem with setting a single interval using setCurrentInterval is that
you can only have one interval running at a time, while the problem with
clearAllIntervals intervals is being forced to reset those you want to keep.


So I just wanted to share another idea, clearing all intervals EXCEPT those
you want to keep.


//
//  CLEAR ALL INTERVALS - EXCEPT
//

function clearAllIntervalsExcept ( a:Array  )
{
var x = {};
for ( var i in a ){ x [ '_' + a [ i ] ] = 1; };

// create new interval
var id = setInterval ( this, 'blank', 0 );
while ( id != 0 )
{
// count through all intervals and clear them one by one
// except those defined in the array
if ( !x [ '_' + id ] ) clearInterval ( id );
id--;
}
}

function test ()
{
trace ( arguments );
}

var _1 = setInterval ( this, 'test', 0, 1, 0 );
var _2 = setInterval ( this, 'test', 0, 2, 0 );
var _3 = setInterval ( this, 'test', 10, 3, 10 );
var _4 = setInterval ( this, 'test', 100, 4, 100 );
var _5 = setInterval ( this, 'test', 1000, 5, 1000 );

var exceptionArray = [ _4, _5 ];

clearAllIntervalsExcept ( exceptionArray ); // only _4 and _5 will run







_

Jesse Graupmann
www.jessegraupmann.com   
www.justgooddesign.com/blog/
_




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jesse
Graupmann
Sent: Thursday, April 26, 2007 9:13 PM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] Clear Set Interval Q:

@ Muzak

Clearing the previous interval works as expected. I'm showing the same
example with a little more padding to illustrate how it might be better used
inside another function - the benefit being the ability to still keep track
of the most current interval id.

//
//  ONLY ONE INTERVAL
//

function setCurrentInterval () 
{
var id = setInterval.apply ( null, arguments )
clearInterval ( id - 1 );
return id;
}

function something () 
{
trace( 'something' );   
}

var id = setCurrentInterval ( this, "something", 0 )
var id = setCurrentInterval ( this, "something", 10 )
var id = setCurrentInterval ( this, "something", 100 )
var id = setCurrentInterval ( this, "something", 1000 )

trace( 'ID: ' + id );



Personally I hate intervals, and I don't mind saying that. For all the
problems they cause due to scope issues and whatnot, but unfortunately you
can't avoid them if you really care about time. So I say just clear them
all.


//
//  CLEAR ALL INTERVALS
//

function clearAllIntervals ( )
{
// create new interval
var id = setInterval ( this, 'blank', 0 );
while ( id != 0 ){
// count through all intervals and clear them one by one
clearInterval ( id )
id--
}
}
clearAllIntervals ( );



Through the course of this discussion about the never ending saga of
intervals, a few things beyond the last example stood out at me.

setInterval is probably just using 'apply' when you don't supply scope.

//
//  SCOPE TEST
//
function whoAmI ()
{
trace ( 'I am: ' + this + ' saying: ' + arguments );
}

whoAmI.apply ( this, ['Hello World'] )
whoAmI.apply ( null, ['Hola World'] )
setInterval ( whoAmI, 100, 'Goodbye World' ); 

//  I am: _level0 saying: Hello World
//  I am: undefined saying: Hola World
//  I am: undefined saying: Goodbye World



And for as often and inaccurate as they want to fire, I often think the best
solution is to check time change from the last frame to the current with
whatever method. I assumed Intervals only fired once per frame, but
apparently they fire as often and as accurate as they 'can'.

//
//ONENTERFRAME VS. SETINTERVAL
//

fTime = getTimer()
iTime = getTimer();
var frame = 0;

var id = setInterval ( this, 'onInterval', 0 );
function onInterval () {
var now = getTimer();
var change = now - iTime;
iTime = now;
trace( 'onInterval: \tf: ' + ( frame ) + '\tc: ' + change );
}

this.onEnterFrame = onFrame;
function onFrame()

{
var now = getTimer();
var change = now - fTime;
fTime = now
trace( '\nonFrame: \tf: ' + ( frame++ ) + '\tc: ' + change +
newline);
}


RE: [Flashcoders] Wave effect

2007-04-27 Thread Jesse Graupmann
http://www.reflektions.com/miniml/ has a ton of info on this and more.

Check out:
http://www.reflektions.com/miniml/template_permalink.asp?id=356 
http://www.reflektions.com/miniml/template_permalink.asp?id=108



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Friday, April 27, 2007 6:02 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Wave effect

google: "flash mac dock"

here's one:
http://jrgraphix.net/research/flash-dock-mx-2004.php

there's more of them, check google.


- Original Message - 
From: "Parvaiz Patel" <[EMAIL PROTECTED]>
To: 
Sent: Friday, April 27, 2007 2:50 PM
Subject: [Flashcoders] Wave effect


>
> Hi,
>
> Anybody knows how to create the wave effect shown in
> (http://www.mandchou.com/) at the bottom for dynamically loaded images.
> Pls let me know.
>
> Thanks & regards,
> PP


___
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] Clear Set Interval Q:

2007-04-26 Thread Jesse Graupmann
@ Muzak

Clearing the previous interval works as expected. I'm showing the same
example with a little more padding to illustrate how it might be better used
inside another function - the benefit being the ability to still keep track
of the most current interval id.

//
//  ONLY ONE INTERVAL
//

function setCurrentInterval () 
{
var id = setInterval.apply ( null, arguments )
clearInterval ( id - 1 );
return id;
}

function something () 
{
trace( 'something' );   
}

var id = setCurrentInterval ( this, "something", 0 )
var id = setCurrentInterval ( this, "something", 10 )
var id = setCurrentInterval ( this, "something", 100 )
var id = setCurrentInterval ( this, "something", 1000 )

trace( 'ID: ' + id );



Personally I hate intervals, and I don't mind saying that. For all the
problems they cause due to scope issues and whatnot, but unfortunately you
can't avoid them if you really care about time. So I say just clear them
all.


//
//  CLEAR ALL INTERVALS
//

function clearAllIntervals ( )
{
// create new interval
var id = setInterval ( this, 'blank', 0 );
while ( id != 0 ){
// count through all intervals and clear them one by one
clearInterval ( id )
id--
}
}
clearAllIntervals ( );



Through the course of this discussion about the never ending saga of
intervals, a few things beyond the last example stood out at me.

setInterval is probably just using 'apply' when you don't supply scope.

//
//  SCOPE TEST
//
function whoAmI ()
{
trace ( 'I am: ' + this + ' saying: ' + arguments );
}

whoAmI.apply ( this, ['Hello World'] )
whoAmI.apply ( null, ['Hola World'] )
setInterval ( whoAmI, 100, 'Goodbye World' ); 

//  I am: _level0 saying: Hello World
//  I am: undefined saying: Hola World
//  I am: undefined saying: Goodbye World



And for as often and inaccurate as they want to fire, I often think the best
solution is to check time change from the last frame to the current with
whatever method. I assumed Intervals only fired once per frame, but
apparently they fire as often and as accurate as they 'can'.

//
//ONENTERFRAME VS. SETINTERVAL
//

fTime = getTimer()
iTime = getTimer();
var frame = 0;

var id = setInterval ( this, 'onInterval', 0 );
function onInterval () {
var now = getTimer();
var change = now - iTime;
iTime = now;
trace( 'onInterval: \tf: ' + ( frame ) + '\tc: ' + change );
}

this.onEnterFrame = onFrame;
function onFrame()

{
var now = getTimer();
var change = now - fTime;
fTime = now
trace( '\nonFrame: \tf: ' + ( frame++ ) + '\tc: ' + change +
newline);
}

//


onFrame:f: 1c: 85

onInterval: f: 2c: 8
onInterval: f: 2c: 8
onInterval: f: 2c: 9
onInterval: f: 2c: 8
onInterval: f: 2c: 7
onInterval: f: 2c: 8
onInterval: f: 2c: 8
onInterval: f: 2c: 9
onInterval: f: 2c: 8
onInterval: f: 2c: 7
onInterval: f: 2c: 28

onFrame:f: 2c: 108

onInterval: f: 3c: 5
onInterval: f: 3c: 7
onInterval: f: 3c: 8
onInterval: f: 3c: 8
onInterval: f: 3c: 8
onInterval: f: 3c: 9
onInterval: f: 3c: 7
onInterval: f: 3c: 8
onInterval: f: 3c: 8
onInterval: f: 3c: 8
onInterval: f: 3c: 9

onFrame:f: 3c: 85




_

Jesse Graupmann
www.jessegraupmann.com  
www.justgooddesign.com/blog/   
_




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Wednesday, April 25, 2007 9:59 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Clear Set Interval Q:

I was referring to this usage:
clearInterval(setInterval(this, "something", 1000) - 1)

I'd actually have to test this (which I haven't), but it looks to me like
this will prevent 2 intervals to run at any given time.

regards,
Muzak

- Original Message - 
From: "Steven Sacks" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, April 25, 2007 6:25 PM
Subject: Re: [Flashcoders] Clear Set Interval Q:


> Danny,
>
> I think you're missing out by not using Intervals.  They're extremely
useful (and efficient) once you get familiar with them.
>
> If you'

RE: [Flashcoders] WhITE SNOW and Seven Dwarf - MAth Problems!

2007-04-26 Thread Jesse Graupmann
I'm glad you cleared up exactly what you are attempting to do. I found this
to be a very interesting challenge. 

The goal here was to minimize the amount of processes it will take to
increment a given length at an adjustable stagger. I'm no mathematician but
I haven't seen any problems unless you use 1 or 0 as an increment.  


//
//  VARS
//

var inx = 0; // CURRENT INDEX
var len = 10; // LENGTH OF VALUES
var incr = 3;// STAGGER INCREMENT


//
//  FUNCTION
//

function update ()
{
trace( '\nUPDATE: ' + inx );

for ( var i = inx; i < len; i+= incr ) 
{ 
trace( '\t' + i );
}
inx += inx < incr-1 ? 1 : -incr+1; 
}
onEnterFrame = update;


///


UPDATE: inx: 0
i: 0
i: 3
i: 6
i: 9

UPDATE: inx: 1
i: 1
i: 4
i: 7

UPDATE: inx: 2
i: 2
i: 5
i: 8

UPDATE: inx: 0
i: 0
i: 3
i: 6
i: 9




So as to not throw away hard work, here was my original solution with as
close to what I could assume with the problem before your last post.

It's much like the version above except it doesn't wrap the index, it stores
a reference to any object passed during a current index, and each set has a
lifespan of the WAIT_FRAMES.



curInx = 0;
sets = {};
WAIT_FRAMES = 10;

this.onEnterFrame = runTest;

function runTest()
{
updateSets (); // update index, remove old sets

// add new objects
addObj ( curInx + '_a' );
addObj ( curInx + '_b' );
addObj ( curInx + '_c' );
addObj ( curInx + '_d' );
addObj ( curInx + '_e' );
}

function updateSets ()
{
// remove old objects
removeSet ( curInx - WAIT_FRAMES );

// increase the index
curInx++;

// make an array for the new index
sets [ '_' + curInx ] = [];

// debug info
trace( '\ncurInx: ' + curInx + newline ); }

function addObj ( obj )
{
// add an object to the current index
sets [ '_' + curInx ].push ( obj ); }

function removeSet ( inx:Number )
{
// only remove available sets
if ( inx < 0 ) return;

// get set information
var set = sets[ '_' + inx ];

// loop through set
var len = set.length;
for ( var i = 0; imailto:[EMAIL PROTECTED] On Behalf Of Erich
Erlangga
Sent: Wednesday, April 25, 2007 6:15 PM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] WhITE SNOW and Seven Dwarf - MAth Problems!

onEnterFrame/setInterval function is just to give spreading effect to the
app. 
  as I mention earlier, using for loop doesnt't let any animation play
before loop ends. 
  the real problem is only about the SEQUENCE-PATTERN. 
  but, to make my question clearer 
  1. for example: there are 7000 nodes to count
  2. using one variable such as i inside loop is OK, although using for loop
to counts 
  more  than 2000 nodes make everything slows down
   
  for (var i=0;  i<7000; i++) drawNodes();--> hangs!!
 
  but I want the counting process run faster by adding another variable
which counts
  with different starting Number. thats is DIVIDING the drawing process
into 7 part and
  run simultaneously as well
   
  3. explaining my previous code:
 variable a counts ---> 1,  8,  15,  22 and so forth..adding 7 to
prev number each time
 variable a counts ---> 2,  9,  16,  23 and so forth..adding 7 to
prev number each time
 variable c counts ---> 3, 10,  17, 24 and so forth..adding 7 to
prev number each time
 variable d counts ---> 4, 11,  18, 25 and so forth..adding 7 to
prev number each time
 variable e counts ---> 5, 12,  19, 26 and so forth..adding 7 to
prev number each time
 variable f counts --->  6, 13,  20, 27 and so forth..adding 7 to
prev number each time
 variable g counts ---> 7, 14,  21, 28 and so forth..adding 7 to
prev number each time

 it is very much like telling 7 people to count 1000 number at different
start and at the
same time. As a result,  the total 7000 nodes are ALL being read with
shorter time. 
 if only one such as variable "i" in many normal loop, then variable "i"
would count one, 
 two,  three  up to...seven thousand (and a hospital await in
front of "i")
 
 i guess there must be a math/words for this sequence and to achieve 
 the result in a smarter way
  

Danny Kodicek <[EMAIL PROTECTED]> wrote:
  

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf 
> Of Erich Erlangga
> Sent: 24 April 2007 14:27
> To: flashcoders@chattyfig.figleaf.com
> Subject: [Flashcoders] WhITE SNOW and Seven Dwarf - MAth Problems!


> //run 7 times faster for attaching symbol in the library
> //(depends on h

RE: [Flashcoders] OT: Salary Questions

2007-04-17 Thread Jesse Graupmann
More orientated to designers & front end developers - but still interesting:

AIGA|Aquent Salary Survey 
http://www.aiga.org/content.cfm/salary-survey




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kelly Smith
Sent: Tuesday, April 17, 2007 11:37 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] OT: Salary Questions

Here in the SF Bay Area, the skillset you describe above would net you
between 100 - 120k a year. Bosses love people who can do database, buisness
logic, AND presentation work. Don't settle.

- k

On 4/16/07, Jordan Snyder <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I'm in Oklahoma City, so it's a bit harder sometimes for me to gauge
> how much compensation I should receive.  If anyone has any comments on
> the following information, please let me know.  I won't disclose my
> exact salary, but you can email me offlist if you're curious.
>
> My title is Application Developer, but I am the only person here (and
> always have been) that knows the difference between a boolean and a
> string.  I am the only technical person and I often take on
> experienced IT-related roles such as web server configuration, shell
> scripting, server monitoring/management, etc (mostly Unix-based, some
> Windows 2000).
>
> I architect and build all backend solutions (PHP, mySQL, CF, RoR,
> J2EE) and desktop solutions (Cocoa, Java, Flash/mProjector).  I have
> extensive knowledge of media streaming and FCS/FMS application
> development.
>
> I also architect all web-based applications and provide diagrams and
> documentation for them, after meeting with clients or upper management
> directly to translate business objectives into software tools.
>
> I then sit down and do ALL of the development work.  I work with one
> designer but I do all UI/interactivity design.
>
> I also manage a small team of interactive designers and producers.
>
> My title does not reflect these duties, but it is difficult to
> communicate to my boss what I do.  I am getting roughly what a junior
> Actionscript developer would make, and I'm fed up.  There are also no
> stock options, no profit sharing, no retirement (401K), no vision nor
> dental.  We get a very simple medical insurance plan.
>
> I am looking for advice on this matter.  Do I expect too much if I
> demand at least $90K a year?  How do I better inform management as to
> what I actually do on a daily basis?  If I'm right in thinking that
> I'm getting screwed, is anyone hiring?  ;)
>
> Cheers!
>
> --
> Jordan Snyder
> [EMAIL PROTECTED]
> (Company Undisclosed)
> ___
> 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] attaching an event to a movie clip

2007-04-06 Thread Jesse Graupmann
Or you can use the MovieClipLoader()...




//
//  DATA
//


imageData =
{
dir: "models/",
ext: ".jpg",
images: [
 {title:'myfirst', path:"image1"}, 
 {title:'mysecond', path:"image2"}
 ],
clips: []
};

//
//  CREATE
//

var xspace = 100;
var yspace = 100;
var holder = this.createEmptyMovieClip ( 'holder',
this.getNextHighestDepth();
var len = imageData.images.length;

for (i = 0; i < len; i++)
{
var mc = holder.createEmptyMovieClip ( 'mc_'+ i,
holder.getNextHighestDepth() )
mc.image = mc.createEmptyMovieClip ( 'image',
mc.getNextHighestDepth() )

mc.loader = new MovieClipLoader();
mc.loader.addListener( mc );
mc.onLoadInit = proxyBEFORE ( this, image_onLoadInit, i );
mc.onLoadError = proxyBEFORE ( this, image_onLoadError, i );
mc.loader.loadClip( imageData.dir + imageData.images[i].path +
imageData.ext, mc.image );

mc.id = i;
mc._x= xspace * -i;
mc._y = yspace * i;

imageData.clips.push ( mc );
}

//
//  LOADING
//

function image_onLoadError ( id, image )
{
var mc = imageData.clips [ id ];
trace( 'image not loaded for: ' + mc );
}

function image_onLoadInit ( id, image )
{
var mc = imageData.clips [ id ];

delete mc.loader;
delete mc.onLoadInit;

mc.onRollOver = function()
{
var title = imageData.images [ id ].title;
var path = imageData.images [ id ].path;

trace( 'title: ' + title +  '  path: ' + path )
}
}


//
//  PROXY
//

function proxyBEFORE (s:Object, func:Function):Function
{
// from jgDelegate
var a:Array = arguments.slice(2, arguments.length);
    return function ():Void { func.apply(s, a.concat(arguments));};
}






_

Jesse Graupmann
www.jessegraupmann.com  
www.justgooddesign.com/blog/   
_




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Ngo
Sent: Friday, April 06, 2007 12:30 PM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] attaching an event to a movie clip

Personally, I find onEnterFrames bad practice to use unless you absolutely
have to (if your logic is frame-based, etc). I would suggest the nested clip
and/or use MovieClipLoader to handle your image loading.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of john
robinson
Sent: Friday, April 06, 2007 11:48 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] attaching an event to a movie clip

You have 2 choices so far... you can set up a poll (using onEnterFrame) 
to figure out when the images have finished loading and then attach the 
events or you can do as David suggested and nest your images inside 
another clip. I don't really know if either solution is better than the 
other, but with the code you already have and what David suggested you 
can make a few changes and probably get by. Some code:


var models = new Array();

models = [ "model1", "model2", "model3", "model4"];

trace(models.length);
for (i=0; i 0) {
delete this.onEnterFrame;
// your image is now loaded... do whatever you want here.
}
}


John




On Apr 6, 2007, at 2:25 PM, Gustavo Duenas wrote:

> I did, but it is the same...nothing so far...I guess that one of you 
> maybe have been in this problem before...so I'd like to know how can I 
> finish it.
>
>
> Regards
>
>
> Gustavo
> On Apr 6, 2007, at 2:04 PM, Rost, Andrew wrote:
>
>> newMC.rollOver
>>
>> Should be:
>>
>> newMC.onRollOver
>>
>> HTH
>>
>> -Original Message-
>> From: Gustavo Duenas [mailto:[EMAIL PROTECTED]
>> Sent: Friday, April 06, 2007 12:43 PM
>> To: Flashcoders@chattyfig.figleaf.com
>> Subject: [Flashcoders] attaching an event to a movie clip
>>
>> Hi , Ok it doesn't sound as simple,
>>
>> I've created a series of empty movieclips which loads pics from an
>> array, so far it loads perfectly but I can attach to the newly
>> created movie clip any kind of
>> events.
>>
>> I'm using this.
>>
>> stop();
>>
>> var models = new Array();
>>
>> models = [ "model1", "model2", "model3", "model4"];
>>
>> trace(model

  1   2   >