Re: [Flashcoders] NetStream time and seek

2007-08-15 Thread JOR
Eric already provided you with a link to the manual page of the seek() 
method that answers this question.


Your problem is you want to seek to a point in time that is not a 
keyframe.  You can not do this for a very good reason.  A keyframe is an 
uncompressed frame and all the frames in-between keyframes are change 
only frames.  You can not seek to a change only frame because it 
doesn't contain enough information to display the whole frame. 
Therefore, it starts with the closest keyframe and plays from there.


You probably witness this when you are watching a video online.  Have 
you every watched a video and the video freezes because you lose the 
connection but when it resumes again it just starts drawing the changed 
areas of the video right on top of what you saw last?  (I have Dish 
Network and I have to tell you this has been getting worse and worse 
with my TV service.) This happens because the video doesn't start from a 
keyframe.  But, As soon as it gets to a keyframe, the whole video is 
clear again and plays normally.  You can not intentionally seek to a 
non-keyframe using the seek() method.


-- James


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Helmut Granda wrote:

I think this is why I got confused..



In an FLV file seek will jump to the keyframe, which is the nearest to
the given time. In other words: you can seek only to keyframes.

Attila



What I am trying to do. Simple. I have a video that is 10 seconds long and i
need to use the seek method to land at 0.33, for some odd reason when I do
that the video jumps to second 10. I have tried to force the video to jump
to 0.33 using an interval as well as other methods but all seem to fail.
That is why I started to investigate in a different approach to do this. One
way to solve this was to use cue points. Of course the video has already
been compressed and I can't add cue points but I figured that we can add cue
points on the fly to the Media component. But unfortunately the video player
I am using is a 3rd party and I cant add cue points.

Does that makes more sense?

TIA


On 8/15/07, Peter B [EMAIL PROTECTED] wrote:


I sent this info couple of days ago. But I guess it didnt make it to the
list:



Yes, it made it to the list, it just didn't make your question any
clearer. FLVs are never treated by frame, they are treated by
timecode. If you describe what you are trying to *achieve*, it may
help others to help 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



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] NetStream time and seek

2007-08-15 Thread JOR
I thought I remembered it being the next keyframe as well but when I 
looked at the Flash docs I read the following:


Description
Method; seeks the keyframe closest to the specified number of seconds 
from the beginning of the stream.


-- James



Burak KALAYCI wrote:

Let me add the following for the record:

JOR Therefore, it starts with the closest keyframe and plays from there.

ARIn an FLV file seek will jump to the keyframe, which is the nearest to
the given time.

Actually, it's not the closest or nearest key frame, it's the next key 
frame. (I'm not saying the above is wrong, they are just not clear).


Let's assume you have a key frame at every second start. If you try to 
seek to 3:050 (seconds:milliseconds), you'll land on the key frame at 
4:000 (not the one at 3:000).


All the best,
Burak

http://www.asvguy.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] Dynamically setting properties...

2007-08-08 Thread JOR

What is the error you're getting?

Maybe add a trace statement in there to see where it's breaking.  You 
could be trying to set a property that exists only in obj but not in 
a_sprite.


for ( var i in obj ) {
  trace (i +  =  + obj[i]); 
  a_sprite[i] = obj[i];
}

-- James


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Karim Beyrouti wrote:

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.?...

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

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


Re: [Flashcoders] AS3 how to link movieclip manually put on the stage to class member

2007-08-08 Thread JOR

You don't need the extra private var.  You can do something like this:

public class A extends MovieClip
{
  //onthestage_mc is a movieclip manually put in the .fla
  private var onthestage_mc:MovieClip;

  public function A ():void
  {
  }
}


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Martin Tremblay wrote:

Hello group !

Just trying to find the best way to link a movieclip manually put on the
stage to a class member.

Right now this is what I'm doing.

public class A extends MovieClip
{
 private var m_mcOnTheStage:MovieClip;

public function A ():void
{
//onthestage_mc is a movieclip manually put in the .fla
m_mcOnTheStage = onthestage_mc;
}
}


Is there a better way?
 
Martin Tremblay
LVL Studio 


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

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


Re: [Flashcoders] AS3 instantiating a new class object from a string value

2007-07-26 Thread JOR

How about using the abstract factory design pattern?

public class MyFactory {
  public static function createObject(objType:String):* {
switch (objType) {
  case Foo:
return new Foo();
  case Bar:
return new Bar();
  default:
return new Foo();
  }
}

var myObj:* = MyFactory.createObject(Foo);


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Matt Muller wrote:

Hi, I'm trying to instantiate a new class object from a xml attribute which
is a string, but its not having any of it.
I've tried casting the string to an object and also using this['class_id']
etc but no luck.

Does someone have a solution?

Thanks,

MaTT
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Private var not accessible?

2007-06-07 Thread JOR
Eka, was right about the notation being the problem but I thought I 
would mention something small I noticed.


You declare delay as a private property of the class but then declare it 
again as a local variable inside your doSomething() method.  If you 
don't need to access the value of delay outside of the doSomething() 
method I would remove it at a private property of the class.  Otherwise, 
if you do need it outside of the doSomething method I would remove the 
var keyword from in front of the assignment so that you are assigning to 
the class' property and not creating a new local variable.


You might also want to be consistant with your variable names.  You 
prefix Time with n for a Number but don't do so with delay.


Also, you can check out my Timer class for something like this:
http://www.jamesor.com/2006/10/18/as2-timer-class/


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



eric e. dolecki wrote:

I have a simple class and I can't access a private var after using
setTimeout... I typed this up to show whats happening:

class foo extends MovieClip
{
private var nTime:Number = 0.75;
private var delay:Number;

function foo()
{
// stuff
};

public function doSomething():Void
{
trace( nTime ); // works fine [0.75]
var delay = _global.setTimeout( delayedFunc, 1000 );
};

private function delayedFunc():Void
{
trace( nTime ); //undefined ?
};
}

?? I could use setInterval and kill it after the first fire, but setTimeout
is nicer. This is AS2 obviously.

- eric
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Private var not accessible?

2007-06-07 Thread JOR
Oh cool, I never saw the VEGAS framework before.  Looks interesting, 
I'll check it out.


Thanks,
James


eka wrote:

Hello :)

i have the same implementation in VEGAS inspired of the 
flash.util.Timeclass :


http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/src/vegas/util/Timer.as
http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/src/vegas/util/FrameTimer.as 



For me it's a better solution to use this implementation :) I prefere the
dom2/3 of the W3C event model to manage my intervals too ;)

EKA+ :)



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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: capturing a href=link/a events?

2007-05-16 Thread JOR

You can use asfunction.


function foo (bar) {
  trace (bar);
}
this.createTextField(my_txt, this.getNextHighestDepth(), 0, 0, 200, 100);
my_txt.autoSize = true;
my_txt.html = true;
my_txt.htmlText = a href=\asfunction:foo, Hello Word!\Click Me/a;

-- JOR

James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



sebastian wrote:

Hello again, a more difficult question maybe...

Is there any way for me to capture a user click on an href tag inside of 
a CSS formatted html text field?


Here is what I do:
- CDATA formatted text in an XML file.
- load it and associate a CSS file to a generated text field at run time.
- resulting a tags have links assigned to them.
- user 'clicks' them - event capture??

In other words: what I need to do is to hear the event so I can dispatch 
an event to my Controller class [who then sends info to the stats class, 
and opens a browser window with predetermined formatting].


At the moment I can't see a way for this event to be heard by my 
controller. Maybe this is simple? maybe its impossible, or complex... 
any ideas? Javascript maybe?


Thanks for your help!

seb.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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: capturing a href=link/a events?

2007-05-16 Thread JOR
If you try my example in a previous reply you'll see it working with 
passed parameters.


-- JOR


sebastian wrote:

BTW: I've noticed the second parameter doesn't pass, only the first.
I'm using flash 8, AS2.

I think this is a known issue... but I could be wrong. I'm using a split 
function to extract more parameters...


Thought I'd share!

wk,

seb.

eka wrote:


Hello :)

in actionscript (1 or 2) you can use the notation :

a href=asfunction:myMethod,param1,param2Link/a

In your code... in the parent of your textfield (the parent 
movieclip), you

can creates the method myMethod 

example :

var format:TextFormat = new TextFormat(arial, 12) ;
format.bold = true ;

var target:MovieClip = this.createEmptyMovieClip(mc, 1) ;
target._x = 25 ;
target._y = 25 ;
target.myMethod = function( arg1, arg2 )
{
   trace( callback :  + arg1 +  :  + arg2) ;
}

var field:TextField  = target.createTextField( field, 1, 0 , 0, 200, 
20) ;

field.autoSize = true ;
field.border = true ;
field.setNewTextFormat( format ) ;
field.html = true ;
field.htmlText = 'a href=asfunction:myMethod,param1,param2Link/a' ;

You can use TextField.StyleSheet to apply a css style in your fields 
etc


Read the actionscript reference with the words TextField and 
asfunction :)


EKA+ :)

2007/5/16, sebastian [EMAIL PROTECTED]:



Hello again, a more difficult question maybe...

Is there any way for me to capture a user click on an href tag inside of
a CSS formatted html text field?

Here is what I do:
- CDATA formatted text in an XML file.
- load it and associate a CSS file to a generated text field at run 
time.

- resulting a tags have links assigned to them.
- user 'clicks' them - event capture??

In other words: what I need to do is to hear the event so I can dispatch
an event to my Controller class [who then sends info to the stats class,
and opens a browser window with predetermined formatting].

At the moment I can't see a way for this event to be heard by my
controller. Maybe this is simple? maybe its impossible, or complex...
any ideas? Javascript maybe?

Thanks for your help!

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

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


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

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


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

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


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

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


Re: [Flashcoders] Slow-Running Script alert

2007-05-10 Thread JOR
Let's see some code.  It sounds like you might be stuck in a loop where 
you are waiting for the value of something to change before proceeding. 
 If it takes too long for that value to change and you continue to loop 
you will timeout your script and get the alert.  You might be better off 
using event handling and dispatch an event when you're ready to proceed 
this way Flash isn't tied up in a loop.



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Marc Hoffman wrote:
I have a complex web site that does some early xml loading as well as 
loading another movie (an intro) in a higher level. On rare occasions, 
I'm getting the alert about a slow-running script in Flash, which 
freezes the movie. Clicking yes to abort the script, then refreshing 
the page, solves the problem for that instance. By the way, this can 
happen even after a successful loading of the movie, so it's NOT an 
issue of something not being cached.


I've tried a lot of restructuring of how things load, and the problem 
now occurs less frequently, but it's still happening.


Does anyone know exactly what that alert means? Is it ALWAYS a looping 
script, for instance? What other things might cause it? This is a tough 
one to troubleshoot.


The problem is recently occurring in Win I.E. 7, but has been known to 
happen in FireFox 1.5 and in other browsers.


thanks,
Marc



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] simple math question...

2007-03-02 Thread JOR

Try:

// movie_mc is the instance name of the movieClip
// you want to center on the mouse coords.
movie_mc._x = _xmouse - (movie_mc._width/2);
movie_mc._y = _ymouse - (movie_mc._height/2);

If the movieClip size doesn't change you can optimize this by 
precalculating the (movie_mc._width/2) and (movie_mc._height/2) parts so 
you aren't constantly doing it.


-- JOR



[p e r c e p t i c o n] wrote:

good people,

how do i move a moviClip to center itself at (_xmouse, _ymouse)...i have 
the

onPress part down...i just need to center it on those coordinates

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] simple math question...

2007-03-02 Thread JOR

sweet tip, thanks.

-- JOR


T. Michael Keesey wrote:

On 3/2/07, Karina Steffens [EMAIL PROTECTED] wrote:


If your mc's reg point is top left:
 mc._x =  _root.xmouse - mc._width/2
 mc._y =  _root.ymouse - mc._height/2



Incidentally, there's a neat trick you can do to speed up the
calculation AND ensure that the result is an integer (so that the clip
is aligned to the pixel). It's called bitwise shift right:

mc._x =  _root.xmouse - (mc._width  1);
mc._y =  _root.ymouse - (mc._height  1);

The benefit in speed is probably negligible in this case. In a test
where I ran a calculation a million times, shift right was about 200ms
faster than division. (I wonder if the difference might be greater in
AS3, though) However, if you also have to constrain to an integer
(e.g., using Math.floor()), then shift right is over twice as fast as
using Math.floor and division.

Basically, whenever multiplying or dividing by a power of 2, you can
use shift left (for multiplication) or shift right (for division) and
get a faster result that is automatically constrained to an integer.

x  1  is equivalent to  Math.floor(x / 2)
x  2  is equivalent to  Math.floor(x / 4)
x  3  is equivalent to  Math.floor(x / 8)
x  4  is equivalent to  Math.floor(x / 16)

x  1  is equivalent to Math.floor(x * 2)
x  2  is equivalent to Math.floor(x * 4)
x  3  is equivalent to  Math.floor(x * 8)
x  4  is equivalent to  Math.floor(x * 16)

You get the idea

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

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


Re: [Flashcoders] Flash 9 AS3 Resource Management

2007-02-28 Thread JOR

Grant Skinner has some good blog postings on the subject...

http://www.gskinner.com/blog/archives/2006/06/as3_resource_ma.html
http://www.gskinner.com/blog/archives/2006/07/as3_resource_ma_1.html
http://www.gskinner.com/blog/archives/2006/08/as3_resource_ma_2.html
http://www.gskinner.com/blog/archives/2006/09/resource_manage.html
http://www.gskinner.com/blog/archives/2006/09/garbage_collect.html
http://www.gskinner.com/blog/archives/2006/06/understanding_t.html
http://www.gskinner.com/blog/archives/2006/07/as3_weakly_refe.html

-- JOR


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Kalani Bright wrote:

Hi everyone,
 
Does anyone have some tips or tutorials on how to handle resources and

performance issues in flash.
 
I have more of an application than a flash file and things start to slow

down after a while.  I'm thinking the garbage collection mechanism in flash
isn't deleting the objects which aren't needed anymore.
I was able to improve performance somewhat by overriding addEventListener to
put the event listener into an array of objects which I then reference
values from.  When a SuperMovieClip object is removed from the stage an
event listener for that event goes through the array and removes each of the
listeners.  If it is added to the stage again all the listeners are re-added
from the array.
 
Theres some other slow downs I can't account for.  It would be nice if there

was a debugging tool or something so I could see what types of objects are
in memory at any time so I can see whats not getting deleted and what keeps
taking up resources.  I am especially interested in however strategies for
dealing with the issues of instantiation, deletion, events, for resource
optimization.
 
Thank you, thank you, (thank you)
 
Kalani

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] problem with fl9 beta

2007-02-18 Thread JOR
AS3 is completely different than AS2.  You don't add code to the 
timeline.  Instead you create a document class and add code to that. 
Typically, I like to use a class named Main but you can name it 
something more to your liking.


Here is a very simple example of what you might be trying to do.  I 
tried to keep it very basic to illustrate the important differences 
between AS2 and AS3.


You can view the sample and download the source code from here:
http://www.jamesor.com/examples/RotationTest/

-- James


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Gustavo Duenas wrote:
Hi, Ive been doing some experiments (some dumb ones) with the beta of  
flash 9 from adobe labs and I just run this code, something happens,  
maybe its me, but is some basic code. it shouldn't happened that way.
and other issue with this is that the beta doesn't have the check  code 
able, so I don't know if I writing this bad or not.



this is the code.:



stop();
this.onRollOver = function(){
this._rotation--;
}


and this is the message.


**Error** frame1 : Line 5, Column 1 : [Compiler] Error #1087: Syntax  
error: extra characters found after end of program.

}
ReferenceError: Error #1065: Variable  
Timeline1_3526e27cbdd211dbb7a6016cb38e89c is not defined.


ReferenceError: Error #1065: Variable  
Timeline0_3526c86ebdd211dbb7a6016cb38e89c is not defined.






Gustavo Duenas

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] problem with fl9 beta

2007-02-18 Thread JOR

It would help if you posted what the error message was.


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Omar Fouad wrote:

I downloaded the source code but the Main.as file keeps giving me errors,
even with flash 9.
Why??


On 2/18/07, John Grden [EMAIL PROTECTED] wrote:



just a clarification:  You *can* add code to the timeline as with 
previous

versions of flash.

On 2/18/07, JOR [EMAIL PROTECTED] wrote:

 AS3 is completely different than AS2.  You don't add code to the
 timeline.  Instead you create a document class and add code to that.
 Typically, I like to use a class named Main but you can name it
 something more to your liking.

 Here is a very simple example of what you might be trying to do.  I
 tried to keep it very basic to illustrate the important differences
 between AS2 and AS3.

 You can view the sample and download the source code from here:
 http://www.jamesor.com/examples/RotationTest/

 -- James


 James O'Reilly  —  Consultant
 Adobe Certified Flash Expert
 http://www.jamesor.com
 Design • Code • Train



 Gustavo Duenas wrote:
  Hi, Ive been doing some experiments (some dumb ones) with the beta of
  flash 9 from adobe labs and I just run this code, something happens,
  maybe its me, but is some basic code. it shouldn't happened that way.
  and other issue with this is that the beta doesn't have the
check  code
  able, so I don't know if I writing this bad or not.
 
 
  this is the code.:
 
 
 
  stop();
  this.onRollOver = function(){
  this._rotation--;
  }
 
 
  and this is the message.
 
 
  **Error** frame1 : Line 5, Column 1 : [Compiler] Error #1087: Syntax
  error: extra characters found after end of program.
  }
  ReferenceError: Error #1065: Variable
  Timeline1_3526e27cbdd211dbb7a6016cb38e89c is not defined.
 
  ReferenceError: Error #1065: Variable
  Timeline0_3526c86ebdd211dbb7a6016cb38e89c is not defined.
 
 
 
 
 
  Gustavo Duenas
 
  ___
  Flashcoders@chattyfig.figleaf.com
  To change your subscription options or search the archive:
  http://chattyfig.figleaf.com/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




--
[  JPG  ]
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] OnRollOver Scrolling Text Problem

2007-02-16 Thread JOR
Your example didn't include checking the X axis so I didn't include it. 
 I've posted a revised working example along with source code here: 
http://www.jamesor.com/examples/Scroller/


I've modified my previous example to enable scrolling only when the 
mouse is within the mask area.


-- james



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



JOR wrote:
If you place your contents of the movieclip so that everything is 
registered with the top left corner to 0,0 of the clip the following 
should work:


var maxMouseY:Number = mask._height;
var maxListY:Number  = maxMouseY - list._height;
onEnterFrame = function ():Void {
  if ((_ymouse  maxMouseY)  (_ymouse  0)) {
list._y = maxListY * (mask._ymouse/maxMouseY);
  }
};

Basically, I'm getting the mouse coords as a range from 0 to 1 
(mask._ymouse/maxMouseY) where the _ymouse is located within the mask 
clip.  0 being the top most pixel and 1 being the bottom most.


Once I have that I multiply it by the maximum movement (maxListY) the 
list is allowed to move to get the scroll postion.  The maximum amount 
the list is able to move is 0 for starting position and a negative 
number if it's scrolled up.  The lowest negative number allowed is 
figured by taking the mask height and subtracting the height of the list 
(mask._height - list._height).



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Omar Fouad wrote:


Hey list this is my first problem i am posting here, i hope someone could
halp me!!!

i got a movie clip with inside four Key Frames... in each Key Frame i 
got a

mask called 'mask' (a rectangle) and a masked MC called 'list'.

than in the first layer of each keyframe (which i reserved it for
actionScript only) i put the following code:

maskY = mask._y;
maskY2 = maskY+mask._height
maskX = mask._x;
maskX2 = maskX + mask._width;
var ratio = Math.round(list._height / mask._height);

onEnterFrame = function () {
  if (_ymousemaskY2  _ymousemaskY) {
  list._y = (mask._ymouse-(mask._ymouse*2))*ratio+maskY;
 }
};

it works. But it seems that the 'list' MC overscrolls as it slides up 
more

than it should do.
can someone help me please in resolving this ???

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


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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

2007-02-16 Thread JOR
Additionally, you may opt to use else if so that the second expression 
isn't evaluated if the first one evaluates true.


...
}
else if(delta0){
...



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Patrick Matte | BLITZ wrote:

function onEnterFrame(){
var delta:Number = mc._x - oldX;
if(delta0){
launching;
}
if(delta0){
launching2;
}
oldX = mc._x;
}

BLITZ | Patrick Matte - 310-551-0200 x214

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gustavo
Duenas
Sent: Friday, February 16, 2007 10:48 AM
To: Flashcoders mailing list
Subject: [Flashcoders] help

Hi, I need desperately some help...how can I detect if some dragged  
object is moving right or left.
Because I need to trigger some event when its moving right and other  
when it is moving left.


so far I'm trying to use this, but it appears to be useless.


this is the code inside the object which is dragged.


var xright = this._x+1;
var xleft = this._x-1;

if (this._x==xright){
launching
}
if(this._x==xleft){
launching2
}




regards



Gustavo Duenas

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] OnRollOver Scrolling Text Problem

2007-02-15 Thread JOR
If you place your contents of the movieclip so that everything is 
registered with the top left corner to 0,0 of the clip the following 
should work:


var maxMouseY:Number = mask._height;
var maxListY:Number  = maxMouseY - list._height;
onEnterFrame = function ():Void {
  if ((_ymouse  maxMouseY)  (_ymouse  0)) {
list._y = maxListY * (mask._ymouse/maxMouseY);
  }
};

Basically, I'm getting the mouse coords as a range from 0 to 1 
(mask._ymouse/maxMouseY) where the _ymouse is located within the mask 
clip.  0 being the top most pixel and 1 being the bottom most.


Once I have that I multiply it by the maximum movement (maxListY) the 
list is allowed to move to get the scroll postion.  The maximum amount 
the list is able to move is 0 for starting position and a negative 
number if it's scrolled up.  The lowest negative number allowed is 
figured by taking the mask height and subtracting the height of the list 
(mask._height - list._height).



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Omar Fouad wrote:

Hey list this is my first problem i am posting here, i hope someone could
halp me!!!

i got a movie clip with inside four Key Frames... in each Key Frame i got a
mask called 'mask' (a rectangle) and a masked MC called 'list'.

than in the first layer of each keyframe (which i reserved it for
actionScript only) i put the following code:

maskY = mask._y;
maskY2 = maskY+mask._height
maskX = mask._x;
maskX2 = maskX + mask._width;
var ratio = Math.round(list._height / mask._height);

onEnterFrame = function () {
  if (_ymousemaskY2  _ymousemaskY) {
  list._y = (mask._ymouse-(mask._ymouse*2))*ratio+maskY;
 }
};

it works. But it seems that the 'list' MC overscrolls as it slides up more
than it should do.
can someone help me please in resolving this ???

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] using mx.controls package in an Actionscript 3.0 Project

2007-02-13 Thread JOR
Please post a solution if you ever figure it out.  I was trying the same 
thing with Radio Buttons and finally gave up after a few hours.


I did figure out that you need to reference the framework.swc and 
framework_rb.swc in the build library for Flex Builder 2 to find the 
classes but I'm guessing there's more to it because while my code 
compiled error free, I never did get to see the controls on stage.


-- James


Arseniy Shklyaev wrote:

I m in AS 1,2 yet. But I guess maybe it cuz of font not embeded or text
field width height not specifeid?

On 2/13/07, August Gresens [EMAIL PROTECTED] wrote:



Hello

I'm trying to use an mx.controls.TextArea in my ActionScript 3.0 project.

var textArea:TextArea = new TextArea();
textArea.text = foo;
addChild(textArea);

Nothing shows up - I suspect there is more to using flex controls in an
AS3
project.

Can anyone point me to some info about this?

Thanks,

August

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

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


Re: [Flashcoders] using mx.controls package in an Actionscript 3.0 Project

2007-02-13 Thread JOR
Below is my test class of trying to pragmatically add a set of radio 
buttons to an ActionScript 3.0 project.  Do you see anything I may have 
done incorrectly?  When I run it, I don't get any compile errors but I 
also don't see any radio buttons.


-- James


package
{
  import flash.display.Sprite;
  import flash.events.MouseEvent;
  import mx.controls.RadioButton;
  import mx.controls.RadioButtonGroup;

  public class TestRadioGroup extends Sprite
  {
private var _group:RadioButtonGroup;
private var _radio1:RadioButton;
private var _radio2:RadioButton;

public function TestRadioGroup()
{
  // radio group
  _group = new RadioButtonGroup();
  _group.addEventListener(MouseEvent.CLICK, onRadioClick);  
  // first radio
  _radio1 = new RadioButton();
  _radio1.label = One;
  _radio1.group = _group;
  addChild(_radio1);
  // second radio
  _radio2 = new RadioButton();
  _radio2.label = Two;
  _radio2.group = _group;   
  addChild(_radio2);
}
public function onRadioClick(event:MouseEvent):void
{
  var rbg:RadioButtonGroup = (event.target as RadioButtonGroup);
  trace (rbg.selection);
}
  }
}




T. Michael Keesey wrote:

Where is this code placed?

On 2/13/07, August Gresens [EMAIL PROTECTED] wrote:


Hello

I'm trying to use an mx.controls.TextArea in my ActionScript 3.0 project.

var textArea:TextArea = new TextArea();
textArea.text = foo;
addChild(textArea);

Nothing shows up - I suspect there is more to using flex controls in 
an AS3

project.

Can anyone point me to some info about this?

Thanks,

August


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Detecting Rollover w/o onRollOver

2007-02-06 Thread JOR
One solution I've used in the past was to use collapse() and 
cancelCollapse() methods.  The parent rollover would use setInterval() 
to call collapse() on a delay of a few milliseconds giving the child 
onRollOver events the ability to be handled first.  The child buttons 
would call cancelCollapse() on roll over which was basically a 
clearInterval() call.  If cancelCollapse() wasn't called by a button 
then collapse() would eventually be called by setInterval().



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Holth, Daniel C. wrote:

It seems like in many of the projects I'm doing I need to have
simultaneous onRollOver events. For example, a small movie clip with
additional buttons needs to enlarge when the mouse is over it so the
user can clearly click the buttons.  However, when the user mouses over
a button, flash no longer detects that the mouse is still over the
movieclip and thus executes the onRollOut event making the movieclip
shrink and the user can't see the buttons clearly anymore.

I've used some code which can tell if the mouse is over an object, and
attaching that to onMouseMove events can basically make two mouse overs.
While its not checking the mouse position every frame, its still not as
efficient as I'd like.


Does anyone have any thoughts on a more efficient way to detect two
mouse over events at the same time?

Thanks!

Daniel Holth




This e-mail and its attachments are intended only for the use of the 
addressee(s) and may contain privileged, confidential or proprietary 
information. If you are not the intended recipient, or the employee or agent 
responsible for delivering the message to the intended recipient, you are 
hereby notified that any dissemination, distribution, displaying, copying, or 
use of this information is strictly prohibited. If you have received this 
communication in error, please inform the sender immediately and delete and 
destroy any record of this message. 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


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Cancelling a load in progress : has this issue ever been fully resolved ???

2007-02-02 Thread JOR
If you are using a MovieClipLoader you could use the unloadClip() 
method.  I've used it successfully in the past though I haven't tried 
every OS/browser/plugin combination to see.


Excerpt from the Flash 8 docs:
ActionScript classes  MovieClipLoader  loadClip
Use MovieClipLoader.unloadClip() to remove movies or images loaded with 
this method or to cancel a load operation that is in progress.


-- james


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Omar Fouad wrote:

currently using actionScript 1 or 2 is not possible. AS 3 has this function
but if you wont use it so i try loading into the same level or the same
container a an swf that doesnt exists. Since you are trying to load an swf
into the same level or movie it will override the firsl loading and trying
to load something else that, obviously doesn't exist. When flash try to 
load

an sfw from a broken link and founds out it is not working, the loadMovie
process stops.



On 2/1/07, David Bellerive [EMAIL PROTECTED] wrote:



Hi! Just wondering if anyone ever found a solution to stop loading
something that is currently loading in the Flash Player (an image, a 
sound,

an XML file, etc.)?

I've heard and tried about loading a dummy (non-existent) file in 
place of
the file being loaded to stop the load process. When I used it, it 
seemed to
work but I've read it doesn't work in all OS/Browser combinations. I 
think
there are issues with this on the Mac, in Safari and/or IE 5. Is that 
right?

Does this method effectively stops a load in progress in all OS/Browser
combinations?

With this method, I noticed that if I halted a load in progress at say 
75%
by loading a dummy file in place of the one currently being loaded, 
and then

restarted loading that file later on, the load starts at 75%. So where is
this partial file being stored? Is it in memory? Is it in the browser
cache (even if it's only partial)?

David



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Cannot Access Superclass Static Var from Subclass in FLA

2007-01-30 Thread JOR
Static variables are not inherited by subclasses in ECMAScript therefore 
can not be referenced through derived class objects.  This differs from 
Java and C#.



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



[EMAIL PROTECTED] wrote:

Hi all. It's been a LONG time since I've posted and now I need your help
again.

I have come across something that to me doesn't seem correct and I don't
know why things are behaving this way. I have 2 classes, one a subclass of
the other. Both have public static variables (AS2.0 Flash 7).

class mypackage.Fruit {
public static var COLOR:Number = 0;
}

class mypackage.Orange extends mypackage.Fruit {
   public static var SEEDS:Number = 0;
}

Now in the Orange class or any other class that needs to use Orange. The
following code: Orange.COLOR returns 0.

import mypackage.Orange;
class Table {
   public function Table() {
  trace(Orange.COLOR:  + Orange.COLOR); // outputs 0
   }
}

Things change when this code is applied to the timeline:

Table.fla
import mypackage.Orange;
trace(Orange.COLOR:  + Orange.COLOR); // outputs undefined
trace(Orange.SEEDS:  + Orange.SEEDS); // outputs 0

Tracing Orange.COLOR gives me undefined. But if I import mypackage.Fruit.
Fruit.COLOR traces out 0.

Table.fla
import mypackage.Fruit;
trace(Fruit.COLOR:  + Fruit.COLOR); // outputs 0

Can someone shed some light on why in an FLA that the subclass (in this
case Orange) cannot access its super class static variables
(Orange.COLOR)?

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

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


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

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


Re: [Flashcoders] Flair Pattern bad mixins good (?)

2007-01-30 Thread JOR
A decorator object composites the object it wishes to decorate and is 
used in it's place.  Since the decorator inherits from the the same base 
class as the object it decorates they can both be used interchangeably 
through polymorphism.


consider something like this:

var myBagel:Bagel = new Bagel();
trace (myBagel.getCalories()); // 200

// Add creamcheese to my bagel
myBagel = new CreamCheeseDecorator(myBagel);
trace (myBagel.getCalories()); // 300

// Add lox to my bagel
myBagel = new LoxDecorator(myBagel);
trace (myBagel.getCalories()); // 330

//---
// bagel looks something like this
public class Bagel {
  public function getCalories ():uint {
return 200;
  }
}
//inside the decorator is something like this:
public class CreamCheeseDecorator extends Bagel {
  private var _bagel:Bagel;
  public function CreamCheeseDecorator (bagel:Bagel) {
_bagel = bagel;
  }
  public function getCalories ():uint {
return _bagel.getCalories() + 100;
  }
}
//inside the decorator is something like this:
public class LoxDecorator extends Bagel {
  private var _bagel:Bagel;
  public function LoxDecorator (bagel:Bagel) {
_bagel = bagel;
  }
  public function getCalories ():uint {
return _bagel.getCalories() + 30;
  }
}

You can add more Bagel types like EggBagel and EverythingBagel and more 
Decorator objects like Butter and use them all interchangeably.


note, this untested code, I just typed it out in the post so their might 
be typos.



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Erik Bianchi wrote:

Opps meant to add: that's my interpretation anyways. I could be wrong. I'm
wrong all the time. In fact I consider myself a professional mistake maker.

-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Erik Bianchi
Sent: Tuesday, January 30, 2007 1:49 PM
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] Flair Pattern bad mixins good (?)

A decorator is meant to be dynamic. It adds responsibilities to an object at
run time.

You take ComponentA and add methods to it on mouseclick, that's a decorator.

ComponentB is made up of ComponentC and ClassA, that's a composite.

My implementation of a mixin which I borrowed from java is really just using
composites + interfaces to emulate multiple inheritance.

Decorators and composites are similar however in that they are both
structural patterns and define an interface for communicating between parent
and child components / classes.

Best,

-erik







-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of T. Michael
Keesey
Sent: Tuesday, January 30, 2007 9:00 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

How is this any different from a Decorator/Wrapper? Looks like a
double decorator.

On 1/30/07, Erik Bianchi [EMAIL PROTECTED] wrote:


Actually my definition of a mixin is very strict compared to a decorator;


it


uses design by contract, composition and declares type:

Class ClassA implements IClassB, IClassC
{

private var classB:ClassB;
private var classC:ClassC;

private function classBMethod():Boolean{...};

private function classCMethod():Number{...};

}


-erik


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of T. Michael
Keesey
Sent: Tuesday, January 30, 2007 12:09 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

On 1/29/07, David Ham [EMAIL PROTECTED] wrote:


startObjectDrag triggered by obj_mc.onPress
checkForSnaptriggered bysetInterval or onEnterFrame type of


event,


in this case onObjectDrag
stopObjectDrag  triggered byobj_mc.onRelease


This looks more like the Broadcaster pattern or the Event Dispatcher
(a.k.a. Observer) pattern than Decorator.

(Also, it might be better to tie checkForSnap to mouseMove.)

Personally, I'm not a big fan of mix-ins because, well, they're kind
of sloppy. They involve tinkering with stuff that should be off-limits
(and is in AS3, I think). Using mix-ins, you could accidentally use a
non-function as a function. That can't happen if you stick to
strictly-typed programming.
--
T. Michael Keesey
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Flair Pattern bad mixins good (?)

2007-01-30 Thread JOR
Yes, it's very common to add additional methods in your subclasses for 
additional behaviour.  Polymorphism is maintained only through the base 
case's interface.


I'll have to check out doFactory, haven't heard of it before.


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Erik Bianchi wrote:

I've seen examples of it both ways where a decorated object maintains the
objects interface or it adds additional methods so it breaks polymorphism.

Don't have the GOF book with me to reference so no idea what they actually
outlined. Doing a quick search wikipedia states 1 to 1 where doFactory shows
otherwise.

On a side note I love doFactory as they offer simple UML diagrams and sample
code (both conceptual and real world).

Been a while since I've posted here, a few years I think. I miss the geek
tangents / debates. =)

-erik



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of JOR
Sent: Tuesday, January 30, 2007 3:55 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

A decorator object composites the object it wishes to decorate and is 
used in it's place.  Since the decorator inherits from the the same base 
class as the object it decorates they can both be used interchangeably 
through polymorphism.


consider something like this:

var myBagel:Bagel = new Bagel();
trace (myBagel.getCalories()); // 200

// Add creamcheese to my bagel
myBagel = new CreamCheeseDecorator(myBagel);
trace (myBagel.getCalories()); // 300

// Add lox to my bagel
myBagel = new LoxDecorator(myBagel);
trace (myBagel.getCalories()); // 330

//---
// bagel looks something like this
public class Bagel {
   public function getCalories ():uint {
 return 200;
   }
}
//inside the decorator is something like this:
public class CreamCheeseDecorator extends Bagel {
   private var _bagel:Bagel;
   public function CreamCheeseDecorator (bagel:Bagel) {
 _bagel = bagel;
   }
   public function getCalories ():uint {
 return _bagel.getCalories() + 100;
   }
}
//inside the decorator is something like this:
public class LoxDecorator extends Bagel {
   private var _bagel:Bagel;
   public function LoxDecorator (bagel:Bagel) {
 _bagel = bagel;
   }
   public function getCalories ():uint {
 return _bagel.getCalories() + 30;
   }
}

You can add more Bagel types like EggBagel and EverythingBagel and more 
Decorator objects like Butter and use them all interchangeably.


note, this untested code, I just typed it out in the post so their might 
be typos.



James O'Reilly  -  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design . Code . Train



Erik Bianchi wrote:


Opps meant to add: that's my interpretation anyways. I could be wrong. I'm
wrong all the time. In fact I consider myself a professional mistake


maker.


-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Erik


Bianchi


Sent: Tuesday, January 30, 2007 1:49 PM
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] Flair Pattern bad mixins good (?)

A decorator is meant to be dynamic. It adds responsibilities to an object


at


run time.

You take ComponentA and add methods to it on mouseclick, that's a


decorator.


ComponentB is made up of ComponentC and ClassA, that's a composite.

My implementation of a mixin which I borrowed from java is really just


using


composites + interfaces to emulate multiple inheritance.

Decorators and composites are similar however in that they are both
structural patterns and define an interface for communicating between


parent


and child components / classes.

Best,

-erik







-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of T. Michael
Keesey
Sent: Tuesday, January 30, 2007 9:00 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

How is this any different from a Decorator/Wrapper? Looks like a
double decorator.

On 1/30/07, Erik Bianchi [EMAIL PROTECTED] wrote:



Actually my definition of a mixin is very strict compared to a decorator;


it



uses design by contract, composition and declares type:

Class ClassA implements IClassB, IClassC
{

private var classB:ClassB;
private var classC:ClassC;

private function classBMethod():Boolean{...};

private function classCMethod():Number{...};

}


-erik


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of T. Michael
Keesey
Sent: Tuesday, January 30, 2007 12:09 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

On 1/29/07, David Ham [EMAIL PROTECTED] wrote:



startObjectDrag triggered by obj_mc.onPress
checkForSnaptriggered bysetInterval or onEnterFrame type of


event,



in this case onObjectDrag
stopObjectDrag  triggered byobj_mc.onRelease


This looks more like the Broadcaster pattern

Re: [Flashcoders] Flair Pattern bad mixins good (?)

2007-01-30 Thread JOR
The Head First Design Patterns book rocks and I definitely recommend it 
to anyone wanting to learn about design patterns.  I actually got a kick 
out of the clip art and humor but I'm kind of quirky that way I guess. 
The Java examples were trivial to port to ActionScript and a good exercise.


The GoF book reads more like a college textbook.  I use it from time to 
time to compare notes between my different pattern books but it's 
definitely not the one I pick up first.  The introduction section of the 
book is a good read.  However, unlike Java or C#, if you don't know C++ 
you might find the examples difficult to understand.


The ActionScript 3 with Design Patterns is also very good.  It's 
obviously very specific to ActionScript unlike the other two books so 
the samples don't need to be ported.




James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



David Ham wrote:
Been a while since I've posted here, a few years I think. I miss  the 
geek

tangents / debates. =)



Good man! Seriously, the world affords precious few opportunities to  
truly geek out on design patterns and such. Internet mailing lists  
excepted of course.


I have the Head First Design Patterns book, and I have to say I like  
it, in spite of its profusion of clip art and cheesy humor. Despite  
these stylistic affronts, it presents the material in a way that is  
easy to learn.


What's the consensus on the GoF book? I know it's a classic, but so  is 
Ulysses and dog if I can read that. I don't have a CS background-- Flash 
is about as far as my programming expertise extends--so the  Head First 
style works for me. Is GoF accessible for people who don't  program in C++?


OK
DAH

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Flair Pattern bad mixins good (?)

2007-01-29 Thread JOR

Erik Bianchi wrote:

The theory of mixins originated from multiple inheritance programming
languages such as C++.

So for example: Say you wanted to make an object dragable, clickable and
resizable. You would then create separate classes called: Dragable,
Clickable and Resizable (common naming convention for a mixin).

Then your base class would just inherit form those 3 classes.

Since AS2 doesn't support multiple inheritances you can emulate a mixin
using interfaces and composed classes.

For example:

IClickable, IDragable, IResizable

So then your AS2 class would say:

Class MyClass extends Whatever implements IClickable, IDragable, IResizable

Those interfaces just specify what methods your class has to support.


From there you could have a class (or a consolidated class) implement that

functionality

private var clickable:Clickable = new Clickable();
private var dragable:Dragable = new Dragable();
private var resizeable:Resizeable = new Resizeable();

from there you just forward / wire the appropriate methods to its
corresponding instances.

public function startResize()
{
this.resizeable.startResize();
}

Or for arguments:

public function startResize()
{
this.resizeable.apply.(this.resizeable.startResize, arguments);
}

You could get even more fancy by externalizing those classes so based on
various rules you could pass in different resize logic, etc.



enter the State and Strategy Patterns :)

The State Pattern would be implemented like the above example when you 
described a fancier version with multiple resize classes. Those resize 
classes can be swapped out at run-time to provide different 
functionality.  For example, the object resizes from the center or from 
the corner depending on the resize class composited.


The Strategy Pattern is similar but the composited functionality is an 
encapsulated algorithm.  In theory, you would have a bunch of concrete 
algorithm classes and depending on your needs at run-time composite the 
right one to perform a calculation.


-- james


--
James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train




___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] problem passing url variables to flash

2007-01-25 Thread JOR

 var video1= nbc6;

Did you mean to type:
var video1 = nbc6;


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Gustavo Duenas wrote:
look guys thanks but it seems not to work , the problem is when it  
loads the movie launch the movie clip which is not supposed to be  until 
I click on the

link in the text file.


the code in the swf object is



var so = new SWFObject(container.swf, sotester, 100%, 100%,  
8, #FF6600);

so.addParam(scale, noscale);

so.addVariable(video, getQueryParamValue(video));

so.write(flashcontent);


in the action script is :


var video1= nbc6;
var video = _root.video;

if (video1 == video){
  this.videoLoader.gotoAndPlay(2);
   }


and the link is fullpage.html?video=nbc6

so far the event launch by itself without using the link.
and this is in the second movie ( I mean the script) it should've  done 
in the main container?...I neep help guys




any ideas



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


Re: [Flashcoders] How to position the caret in a TextField when entering the field?

2007-01-24 Thread JOR
Try using setInterval to delay the setSelection() call by a millisecond 
to perform the carat positioning after flash automatically selects the 
complete text when you press the tab key.


The following code positions the cursor at the end of the text string 
when you tab to a textfield.


// start
var tf:TextField;
for (var i:Number = 0; i5; i++) {
  this.createTextField(field+i+_txt, i, 10, i*25, 200, 20);
  tf = this[field+i+_txt];
  tf.text = this is my text;
  tf.type = input;
  tf.border = true;
  tf.tabEnabled = true;
  tf.tabIndex = i;
}
var listener:Object = new Object();
listener.onSetFocus = function(oldFocus, newFocus) {
  this.setSel = function() {
clearInterval(this.intervalid);
var tf:TextField = eval(Selection.getFocus());
var end:Number = tf.text.length;
Selection.setSelection(end, end);
// or the front of the string
//Selection.setSelection(0, 0);
  };
  this.intervalid = setInterval(this, setSel, 1);
};
Selection.addListener(listener);
// end



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Chris Velevitch wrote:

How to I set the position of the caret when entering or clicking in a
non-empty TextField.

I've tried:-

var field1:TextField;
var field2:TextField;

function onSetFocus():Void {
trace(this+ b=+Selection.getCaretIndex());
Selection.setSelection(0,0);
trace(this+ a=+Selection.getCaretIndex());
}

field1.onSetFocus = onSetFocus;
field2.onSetFocus = onSetFocus;

but it isn't working as expected. When I tab into a field, the whole
content is selected the caret index is -1 before and after I change
the position. When I click in the field, the caret stays at the
position clicked and the caret index is 0 before and after I change
the position.

What am I doing wrong?

Chris

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] mc preloader

2007-01-18 Thread JOR

Take a look at the MovieClipLoader class in the help docs.


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Mike Dunlop wrote:

Hi everyone,

I have a question that is probably easy for you guys. How can i get a  
preloader into the following ?



mc.createEmptyMovieClip(img, 10);
mc.img.loadMovie(some_image_path);
mc.onEnterFrame = function() {
 

// want to put a preloader bar/circle/something to show the load  
progress on
// on the image loading into mc.img   


}

Thanks a bunch as always!
   


.
Mike Dunlop
// Droplab
[ e ] [EMAIL PROTECTED]


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Flash and JAWS

2007-01-17 Thread JOR
I need to add JAWS support to a current application.  Are there any 
developers out there already familiar with integration?


I'm having a problem with JAWS trapping key events so event handlers in 
my app like click any key to continue aren't being called.


I'm also trying to figure out how to submit a form within Flash once 
JAWS enters Forms Mode  The ENTER and SPACE keys both seem to toggle 
Forms mode on/off so it's unclear how the form is suppose to submit.



--
James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train

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

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


Re: [Flashcoders] Flash and JAWS

2007-01-17 Thread JOR

JAWS 8 and Flash 7.

James



Michael Stuhr wrote:

JOR schrieb:

I need to add JAWS support to a current application.  Are there any 
developers out there already familiar with integration?


I'm having a problem with JAWS trapping key events so event handlers 
in my app like click any key to continue aren't being called.


I'm also trying to figure out how to submit a form within Flash once 
JAWS enters Forms Mode  The ENTER and SPACE keys both seem to toggle 
Forms mode on/off so it's unclear how the form is suppose to submit.




which version of Jaws and Flash are you targetting ?

micha

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

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


Re: [Flashcoders] Flash adds seconds to audio clip

2007-01-03 Thread JOR
If I understood your question correctly, it sounds like you've attached 
a sound to a keyframe.  The sound plays and when it reaches a certain 
frame you're expecting the sound to have finished because (12fps * sound 
length) is your expected ending frame.


If you are using a Sync method of Event, this almost certainly will 
not be the case and results will vary from machine to machine the SWF is 
played on because the sound and timeline are independent from each 
other.  The longer the audio, the larger the discrepancy.


If you choose Stream as the Sync method, it will marry the sound to 
the timeline and you can guarantee that your expected frame will hit at 
the right time.



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Frank Dewey wrote:

Hello all,

When I play a 30 second audio file in Flash (.wav or .mp3), it is
taking flash 32 seconds to run it.


To test this, I've made it real simple and only used one layer (The
frame rate for the audio is 12 fps).  The audio starts on the first
frame and lasts until the 361st (30 seconds x 12 fps + 1) frame.  I've
added this code to these frames:

var tmp = new Date();
trace(start time:  + tmp.getSeconds());

On the 362nd frame (immediately after the audio has played) I have
another key frame with this code:

var tmp = new Date();
trace(end time:  + tmp.getSeconds());


That's it.  I just output the time when the movie starts and when it
stops.  When I only use 338 frames (instead of 361), then the whole
clips pays fine and lasts 30 seconds.


Why is a 30 second clip (running at 12 fps) only taking 28.1 seconds to 
play?


Thank you -
 Frank
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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: FW: [Flashcoders] Flash 8 Certification Study Tips?

2007-01-02 Thread JOR

Way to go Doug, congratulations!

I was a bit bummed about the logo saying Designer as well. :(

James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Doug Coning wrote:

Thank you to everyone for their assistance in helping me pass the Flash
8 Certification.  I found your suggestions very helpful!  I spent a day
and a half studying through both Flash 8 Bible and Flash 8 ActionScript
Bible.  As an application developer who spends 95% of my time working
with Components, Web Services, XML and classes, I found the design,
video and audio questions to be challenging.  If you are in the same
boat as I was as a coder, I'd recommend spending time looking at the
video, audio and design features.

One of the things that I thought was interesting is that the test is
titled Macromedia Flash(r) Professional 8 Exam.  However, the logo I was
able to download upon passing the certification and registering states
Flash 8 Designer.  As a developer, I personally would prefer if it just
stated Flash 8 Certified.  Just my opinion...

Thanks everyone for your help.

Doug Coning
Adobe Certified Flash Expert :)

-Original Message-
From: Doug Coning 
Sent: Wednesday, December 20, 2006 10:05 AM

To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] Flash 8 Certification Study Tips?

Excellent!  Thank you for the link.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of JOR
Sent: Wednesday, December 20, 2006 9:23 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Flash 8 Certification Study Tips?

Hey Doug,

I wrote a little about my experience with the exam on my blog.
http://www.jamesor.com/2006/10/04/aryadobecertifiedexpertspushme/

Good luck with your test!
James


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

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


Re: [Flashcoders] Flash Game - Post Encrypted Score to server side script

2006-12-24 Thread JOR

Referrer's can be faked.
James



Mick G wrote:

You can also try checking the HTTP referrer in PHP to make sure people
can only post data to your PHP script from your page on your site.


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Point inside Rectangle ?

2006-12-21 Thread JOR

Hey Olli,

One way to do it without using movieclips is to create an off screen 
buffer image the size of the stage and draw your rectangle to it at the 
proper location.


If you clear the buffer black and draw a white rectangle to it, you can 
then test the coord to see if it's not black.



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Oliver Müller wrote:

Hi all,

I'm looking for a mathematic way to check if a point resides within a 
rectangle.
The rectangle is not parallel to the axes, instead its rotating all the 
time.

It's not a movieclip so hitTest is out of the question.
Any suggestions how I could solve this problem ?

cheers,
olli

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

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


Re: [Flashcoders] Flash 8 Certification Study Tips?

2006-12-20 Thread JOR

Hey Doug,

I wrote a little about my experience with the exam on my blog.
http://www.jamesor.com/2006/10/04/aryadobecertifiedexpertspushme/

Good luck with your test!
James


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Doug Coning wrote:

Greetings All,

 


I'm preparing to take the Flash 8 Certification and was wondering if
anyone who has already taken the test had any study tips on areas that
you wished you may have been more prepared for?

 


Thanks,

 


Doug Coning

Senior Web Development Programmer

FORUM Solutions

[EMAIL PROTECTED]

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Senior Developer Posisition

2006-12-20 Thread JOR

Claus Wahlers wrote:


Never trust statistics that you didn't fake yourself. ;)

Cheers,
Claus.




Kind of like the saying...
It's not the figures that lie, it's the liars that figure.

or my favourite...
87.93% of all statistics are made up on the spot. ;)


heh heh,
James


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Have I got this OOP business right?

2006-11-08 Thread JOR

LOL, for a second there I thought I was looking at a J2ME java class.

Are you trying to port a J2ME game?  I was thinking about porting a game 
I wrote and it started out looking a lot like this.  Then I got busy and 
forgot about it.  You've inspired me to pick it up again.  :)


BTW, looks good to me,
James

--
James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train




Haydn wrote:

Hi,

I've got a simple little game that I'm trying to make with AS2, but I'm 
not sure that I'm doing it right. Here's what I've got so far. I've used 
a 'document class' as described here: http://www.bit-101.com/blog/?p=857


Here's the code in the .fla:

Game.create(this);

In Game.as:

class Game extends MovieClip {

private var splash:Splash;

private var preload:Preload;
private var mainMenu:MainMenu;

private function Game() {

showSplash();
}

public static function create(target:MovieClip):Void {

target.__proto__ = Game.prototype;
Function(Game).apply(target, null);
}

public function showSplash():Void {

Splash.create(this, splash, getNextHighestDepth());
splash.setEndFunction(this, showPreload);
}

public function showPreload():Void {

Preload.create(this, preload, getNextHighestDepth(), this);
preload.setEndFunction(this, showMainMenu)
}

public function showMainMenu():Void {

MainMenu.create(this, mainMenu, getNextHighestDepth());
// etc.
}

}


The Splash, Preload and MainMenu classes each have a static function 
called create that attaches an instance of their symbol to the stage. 
The two setEndFunction functions tell Splash and Preload what call when 
they've finished doing their thing.


Is this a reasonable way of going about things, or am I just making life 
hard for myself?


Thanks,

Haydn.


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Lil' OOP direction needed

2006-11-08 Thread JOR
William Sanders has a nice tutorial up on Adobe's Dev Center about 
creating a video player using OOP and the State Pattern.


http://www.adobe.com/devnet/flashmediaserver/articles/video_state_machine_as3.html

Also, a great book to pick up if you want to start learning OOP is Head 
First Design Patterns.  It's written for Java but don't let that deter 
you.  You should follow along just fine if you know AS syntax.


Cheers,
James


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Marlon Harrison wrote:
I need to develop an on-demand video player that includes a category 
browser
so that users can view a list of videos from a particular category 
(cooking,

for example) or the user can create their own playlist of videos.  My
previous flash experience has been with procedural based actionscripting 
and

I'm having a difficult time determining where to begin in planning out an
OOP approach. I've picked up a few OOP/Actionscript books form Friends of
Ed, and the two Moock books, but I'm still a little unsure on where/how to
begin to make it as modular as possible. I could really use a 'how 
why'-type description if anyone's so inclined…

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] AS2 Timer Class with multiple Events

2006-10-27 Thread JOR

I wrote an AS2 Timer class that mimics the AS3 timer class:
http://www.jamesor.com/2006/10/18/as2-timer-class/

You can also use it as a starting point and tweak it for you needs.

James


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



eric dolecki wrote:

Hey all,

I am looking for a pretty light-weight AS2 Timer class that I can assign
multiple events to...

such as fire an event at 15 seconds, then finally at the end (30 secs).
Something with clean API. I'm googling now.

- e.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Easy to learn and use 3d program

2006-10-27 Thread JOR
Grimm posted a link to Google's SketchUp yesterday and I checked that 
out.  It's pretty sweet.  I normally do all my stuff in 3D Studio but I 
might use this for some rapid model building to import into Max for 
rendering.


http://sketchup.google.com/download.html

The tutorials are worth the viewing to see how cool this really is:
http://sketchup.google.com/tutorials.html

James



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Johan Nyberg wrote:
Hi, I'm looking for an easy to learn and use 3d program to create 
content for Flash. What are your suggestions? I want to do fairly simple 
animations, but I need something that are a bit more complex than say, 
Xara3d.



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Moving to AS2, array always undefined

2006-10-12 Thread JOR
No, it isn't wrong which was entire the point of my earlier response. I 
gave essentially the same example as you.  In fact, you've included it 
quoted at the bottom of your response which I left intact.


However, just because it is correct doesn't mean I prefer it over other 
conventions.  I prefer to use underscores with my field names.


-- james



Ash Warren wrote:

In practice, you're right and I try not to name any parameters the same as
a field name to avoid this confusion.  Don't tell anyone, but sometimes I
don't even use this. :)

So this is wrong?

function MyClass (myParam1:Number, myParam2:String)
{
this.myParam1 = myParam1;
this.myParam2 = myParam2;
}

For me this method seems much easier to read and it even refers to naming
parameters this way in the adobe best-practices article.

Why try and come up with 2 names for the same thing, when one will suffice
just fine?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of JOR
Sent: Tuesday, October 10, 2006 5:52 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Moving to AS2, array always undefined

A bad practice most likely, but not technically wrong.  I do see it in 
text books from time to time.  I was just mentioning it as a case where 
this *would* be needed as opposed to speaking in absolutes.


In practice, you're right and I try not to name any parameters the same 
as a field name to avoid this confusion.  Don't tell anyone, but 
sometimes I don't even use this. :)


James O'Reilly  -  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design . Code . Train



Steven Sacks | BLITZ wrote:


Correct me if I'm wrong, but it looks like your rationale is entirely
based on an argument name being identical to a class variable name.  I
might be looking at this too simply, but shouldn't you just use a
different argument name if it clashes with a class variable name?

-Steven





-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of JOR
Sent: Tuesday, October 10, 2006 1:19 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Moving to AS2, array always undefined

Actually, the need is dependent on the implementation.

It was my understanding that AS first looks to the local scope for the
existence of a variable then works up to find it.  By using this you
were explicitly telling flash that the var isn't local to the function
but rather belongs to the object cutting out a step for the VM.

Therefore, something like the following becomes possible and the use


of



this becomes necessary:

class MyConstructor {
 private var target:MovieClip;
 public function MyConstructor (target:MovieClip) {
   this.target = target;
 }
}

Because you can not do this:

class MyConstructor {
 private var target:MovieClip;
 public function MyConstructor (target:MovieClip) {
   target = target; // ?
 }
}

However, depending on your naming conventions you might not have to
use this if you did something like the following:

class MyConstructor {
 private var _target:MovieClip;
 public function MyConstructor (target:MovieClip) {
   _target = target;
 }
}

Even still, I think the VM might check for the existence of a var


named



_target local to the constructor function before locating the object's
field named _target.

It's been a while since I've done anything in AS1 so I may be way off
here but I thought I remembered this being necessary because at


weird



times the VM would think you were trying to instantiate a local var if
you didn't use this.  Particularly in on (something) event


handlers.



Maybe I'm thinking of _global, or perhaps both.  This, I'm not sure
about... if you'll excuse the pun. :)



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Moving to AS2, array always undefined

2006-10-10 Thread JOR
In AS2 typecasting helps uncover bugs at compile time, so its a good 
idea to use them.  Typecasting also enables class insight through popup 
menus when you type a period after your variable name.


In AS3 typecasting is a much cooler as it directly affects the amount of 
memory allocated for the variable.  You can read about typecasting in 
AS2 and AS3 in my blog entry:

http://www.jamesor.com/2006/08/23/strong-typing-comes-of-age-in-avm2/

In your class there are a few ways to handle the initialization.  You 
can do it at the field level like this:


class ArrayTest {
  public var aryItems:Array = new Array();
  public function test (str:String):Void
  {
this.aryItems.push (str);
trace (this.aryItems);
  }
}

Or you can do it in the class' constructor:

class ArrayTest {
  public var aryItems:Array;
  public function ArrayTest ()
  {
this.aryItems = new Array();
  }
  public function test (str:String):Void
  {
this.aryItems.push (str);
trace (this.aryItems);
  }
}

Or you can create an init() function that
can be used by the constructor as well as being called again after 
object creation.


class ArrayTest {
  public var aryItems:Array;
  public function ArrayTest ()
  {
init();
  }
  public function init ():Void
  {
this.aryItems = new Array();
// other object initializing stuff
  }
  public function test (str:String):Void
  {
this.aryItems.push (str);
trace (this.aryItems);
  }
}

There are more ways to do it than that but those are pretty common and 
should get you started.


You might want to get used to using typecasting because if you ever move 
on to AS3 you will have to use it as its a requirement.



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Jon Bennett wrote:

Hi,

got a AS NooB Q.

I'm working on a project and have decided to finally jump ship to AS2,
but I've run into a (probably obvious) problem which has me a bit
stumped.

I've written a class, in which I have an array, but the array always
traces 'undefined' and I can't work out why.

right, so example code:

// ArrayTest.as

class ArrayTest {

public var items_arr:Array;

public function ArrayTest ()

{
}

public function test (str:String)

{
this.items_arr.push (str);
trace (this.items_arr);
}
}

// Timeline

// import class
import ArrayTest.as;
// create instance
var Test:ArrayTest = new ArrayTest();
// add some values to the array
Test.test ('foo');
Test.test ('bar');

I'm pretty sure this is just me not grasping something bleedin' obvious!

tia,

jon


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Moving to AS2, array always undefined

2006-10-10 Thread JOR

Actually, the need is dependent on the implementation.

It was my understanding that AS first looks to the local scope for the 
existence of a variable then works up to find it.  By using this you 
were explicitly telling flash that the var isn't local to the function 
but rather belongs to the object cutting out a step for the VM.


Therefore, something like the following becomes possible and the use of 
this becomes necessary:


class MyConstructor {
  private var target:MovieClip;
  public function MyConstructor (target:MovieClip) {
this.target = target;
  }
}

Because you can not do this:

class MyConstructor {
  private var target:MovieClip;
  public function MyConstructor (target:MovieClip) {
target = target; // ?
  }
}

However, depending on your naming conventions you might not have to 
use this if you did something like the following:


class MyConstructor {
  private var _target:MovieClip;
  public function MyConstructor (target:MovieClip) {
_target = target;
  }
}

Even still, I think the VM might check for the existence of a var named 
_target local to the constructor function before locating the object's 
field named _target.


It's been a while since I've done anything in AS1 so I may be way off 
here but I thought I remembered this being necessary because at weird 
times the VM would think you were trying to instantiate a local var if 
you didn't use this.  Particularly in on (something) event handlers. 
Maybe I'm thinking of _global, or perhaps both.  This, I'm not sure 
about... if you'll excuse the pun. :)



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Steven Sacks | BLITZ wrote:

There's no need to use this when referring to class variables from
within the class itself.

class ArrayTest {
public var myArray:Array;

public function ArrayTest() {
myArray = [];
}
public function test(str:String):Void {
myArray.push(str);
trace(myArray);
}
}

BLITZ | Steven Sacks - 310-551-0200 x209



-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Jon Bennett
Sent: Tuesday, October 10, 2006 12:44 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Moving to AS2, array always undefined



Or you can do it in the class' constructor:

class ArrayTest {
  public var aryItems:Array;
  public function ArrayTest ()
  {
this.aryItems = new Array();
  }
  public function test (str:String):Void
  {
this.aryItems.push (str);
trace (this.aryItems);
  }
}




___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Moving to AS2, array always undefined

2006-10-10 Thread JOR
A bad practice most likely, but not technically wrong.  I do see it in 
text books from time to time.  I was just mentioning it as a case where 
this *would* be needed as opposed to speaking in absolutes.


In practice, you're right and I try not to name any parameters the same 
as a field name to avoid this confusion.  Don't tell anyone, but 
sometimes I don't even use this. :)


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Steven Sacks | BLITZ wrote:

Correct me if I'm wrong, but it looks like your rationale is entirely
based on an argument name being identical to a class variable name.  I
might be looking at this too simply, but shouldn't you just use a
different argument name if it clashes with a class variable name?

-Steven




-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of JOR
Sent: Tuesday, October 10, 2006 1:19 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Moving to AS2, array always undefined

Actually, the need is dependent on the implementation.

It was my understanding that AS first looks to the local scope for the
existence of a variable then works up to find it.  By using this you
were explicitly telling flash that the var isn't local to the function
but rather belongs to the object cutting out a step for the VM.

Therefore, something like the following becomes possible and the use


of


this becomes necessary:

class MyConstructor {
  private var target:MovieClip;
  public function MyConstructor (target:MovieClip) {
this.target = target;
  }
}

Because you can not do this:

class MyConstructor {
  private var target:MovieClip;
  public function MyConstructor (target:MovieClip) {
target = target; // ?
  }
}

However, depending on your naming conventions you might not have to
use this if you did something like the following:

class MyConstructor {
  private var _target:MovieClip;
  public function MyConstructor (target:MovieClip) {
_target = target;
  }
}

Even still, I think the VM might check for the existence of a var


named


_target local to the constructor function before locating the object's
field named _target.

It's been a while since I've done anything in AS1 so I may be way off
here but I thought I remembered this being necessary because at


weird


times the VM would think you were trying to instantiate a local var if
you didn't use this.  Particularly in on (something) event


handlers.


Maybe I'm thinking of _global, or perhaps both.  This, I'm not sure
about... if you'll excuse the pun. :)



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Moving to AS2, array always undefined

2006-10-10 Thread JOR

Muzak wrote:

http://www.adobe.com/devnet/flash/articles/as_bestpractices.html



Cool find.  Thanks for the link
James
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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 do you manage your classes?

2006-09-26 Thread JOR
Not to say I don't do the same thing on occasion but this might fall 
under the Copy-and-Paste Programming antipattern.


http://en.wikipedia.org/wiki/Copy_and_paste_programming
http://c2.com/cgi/wiki?CopyAndPasteProgramming

Copy-and-Paste Programming isn't necessarily wrong when used in the 
correct context.  Sometimes your copy will mutate into something so 
different that it makes sense to have two separate versions.  However, 
if used poorly or abused it could lead to a headache.


One commenter on the second linked site put it nicely:
If the original code has flaws, not only do you have to hunt down all 
the clones, but what if you miss some? It's like a re-occurring rash - 
Damn, I thought I got rid of that! - it keeps coming back when you think 
its gone for good. -- ToddCoram


I have been specifically looking into software like subversion which 
seems to be the standard.



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



Mike Keesey wrote:

Lately I actually copy all packages to a folder within my project's
folder. Why? Suppose you have a package and you use it on project A.
Later, you use it on project B, and realize there are some issues, so
you change some of the code. Project B finishes. Then, later on, you
find you have to go back to project A with some tweaks and republish it.
Because of changes in the package, there may be problems--at best you
will still have to spend time regression testing.

Copying your packages to a project-local folder means that you have a
secure snapshot of the package.
―
Mike Keesey



-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Dan Rogers
Sent: Monday, September 25, 2006 4:36 PM
To: Flashcoders mailing list
Subject: [Flashcoders] How do you manage your classes?

Flashcoders,

I've been wondering how other flash developers deal with AS2/AS3
class management on both a project-based and common library level,
while addressing the need to package up source code for a given
project to deliver to a team member or client.

I've used version control before, as well as doing the common
classpath thing for shared classes... but when it's time to deliver
the source code to someone, I would have to go in and hunt for all
the classes I used on a project and copy them to the FLA directory
(and recreate the com.package... structure as well).  Sometimes it
seems faster to simply create the AS files along with the FLA (in a
single package), and copy over utility files as needed.  But then you
get into duplicate classes scattered over multiple projects.

Can anyone provide any insight to a system that works well for them?
For example, does anyone run custom shell scripts (such as rsync)
that sync the current project with the main classpath directory?

Thanks,
-Danro

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] Simplify

2006-09-25 Thread JOR
If your getScale function is called many times a second you should keep 
it the way it is.  The way you currently have it is the most efficient 
way of doing it and will yield higher FPS.


However, if speed isn't and issue and you are not calling this function 
very often and want to simplify it purely from a readability standpoint 
then Martin's setPropInGroup() function is a good way to do that.



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



Laurent CUCHET wrote:

How can I simplify this ?

Thak you

function getScale(mc:MovieClip) {
al_mc._xscale =
lor_mc._xscale=frc_mc._xscale=cha_mc._xscale=npc_mc._xscale=pic_mc._xscale=r
ho_mc._xscale=pro_mc._xscale=bou_mc._xscale=lan_mc._xscale=auv_mc._xscale=mi
d_mc._xscale=aqu_mc._xscale=lim_mc._xscale=poi_mc._xscale=cen_mc._xscale=idf
_mc._xscale=han_mc._xscale=ban_mc._xscale=pad_mc._xscale=bre_mc._xscale=100;
//
al_mc._yscale =
lor_mc._yscale=frc_mc._yscale=cha_mc._yscale=npc_mc._yscale=pic_mc._yscale=r
ho_mc._yscale=pro_mc._yscale=bou_mc._yscale=lan_mc._yscale=auv_mc._yscale=mi
d_mc._yscale=aqu_mc._yscale=lim_mc._yscale=poi_mc._yscale=cen_mc._yscale=idf
_mc._yscale=han_mc._yscale=ban_mc._yscale=pad_mc._yscale=bre_mc._yscale=100;
//
al_mc._alpha = 
lor_mc._alpha=frc_mc._alpha=cha_mc._alpha=npc_mc._alpha=pic_mc._alpha=rho_mc

._alpha=pro_mc._alpha=bou_mc._alpha=lan_mc._alpha=auv_mc._alpha=mid_mc._alph
a=aqu_mc._alpha=lim_mc._alpha=poi_mc._alpha=cen_mc._alpha=idf_mc._alpha=han_
mc._alpha=ban_mc._alpha=pad_mc._alpha=bre_mc._alpha=0;
//
al_mc.enabled =
lor_mc.enabled=frc_mc.enabled=cha_mc.enabled=npc_mc.enabled=pic_mc.enabled=r
ho_mc.enabled=pro_mc.enabled=bou_mc.enabled=lan_mc.enabled=auv_mc.enabled=mi
d_mc.enabled=aqu_mc.enabled=lim_mc.enabled=poi_mc.enabled=cen_mc.enabled=idf
_mc.enabled=han_mc.enabled=ban_mc.enabled=pad_mc.enabled=bre_mc.enabled=fals
e;
//
mc._yscale = 300;
mc._xscale = 300;
mc._alpha = 100;
//mc.enabled = true;
mc._x = (550-mc._x)/2;
mc._y = 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] Right-MouseClick

2006-09-22 Thread JOR
I'm using FireFox 1.5.0.7 and get the context menu on my site which uses 
wmode=transparent.



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



Dimitrios Bendilas wrote:

Ok sorry, that's what happens on FireFox, at least the ver. 1.5.0.7
that I'm running here.

So I guess it is a bug indeed.

It's not the case on IE and Opera.

Dimitrios


- Original Message - From: slangeberg [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Friday, September 22, 2006 6:05 PM
Subject: Re: [Flashcoders] Right-MouseClick



Setting wmode as transparent makes the context menu not show up in a
browser.

Are you sure about that? Sounds more like bug than feature!

Scott


On 9/22/06, Dimitrios Bendilas [EMAIL PROTECTED] wrote:



Hi Mike,

Key.isDown(2) -- right mouse button
Key.isDown(4) -- middle mouse button

Setting wmode as transparent makes the context menu not show up in a
browser.

Dimitrios


- Original Message -
From: Meinte van't Kruis [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Friday, September 22, 2006 5:32 PM
Subject: Re: [Flashcoders] Right-MouseClick


 you cant suppress the context menu in flash, you can add items to it
 tho.Might
 be what you're looking for.

 -Meinte

 On 9/22/06, Michael Bedar [EMAIL PROTECTED] wrote:

 Is there a reliable way to detect a r-mouse click, and at the same
 time suppress the context menu? I could swear that there was a simple
 way to do it, but I amy be having a DIrector flashback..no pun
intended.

 Thanks,
 Mike

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

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

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

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




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

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





--

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

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




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

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


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

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


Re: [Flashcoders] Find item in array

2006-09-19 Thread JOR
My original question to Jason was clarification on *why* (--i -(-1)) 
would run faster than (i--) as it seemed to me that two calculations per 
loop would run slower than 1.  Since he used an expression I've never 
seen before I figured he might might know the reasoning behind the 
optimization.  It does in fact surprise me that this method is faster.


You mentioned the reason it ran faster was because it compiled down to 
less lines of code.  But we see this isn't the case.  I need to find 
good documentation/reference on p-code to better understand what is 
going on under the hood.  So far my google searches turn up nothing good 
so any additional links would be appreciated.


My tests so far...

By itself, (i--) runs faster than (--i -(-1)).  However, when used as 
the condition for a while loop (i--) is slower.  That's the part I don't 
get.  Why is it slower?  What's different about being the condition of a 
loop?


Here's my two tests.  I alternated comments so that each of the four 
tests ran by themselves:


//--
// (i--) vs. (--i -(-1))
// Test 1: (i--) is 448 millis faster as standalone
// Test 2: (i--) is 140 millis slower as loop conditional
//
var i,begin,end;
i = 100;
begin = getTimer();
//---
// Test 1 A
while (i) { (i--); }
end = getTimer();
trace(1A: + (end-begin));// avg 1676
//---
// Test 1 B
//while (i) { (--i -(-1)); }
//end = getTimer();
//trace(1B: + (end-begin));  // avg 2124
//---
// Test 2 A
//while (i--) {}
//end = getTimer();
//trace(2A: + (end-begin));  // avg 1620
//---
// Test 2 B
//while (--i -(-1)) {}
//end = getTimer();
//trace(2B: + (end-begin));  // avg 1480

Any thoughts or comments appreciated.  Claus, Darron, you guys 
reading?... I'd bet you guys could shed some light on p-code.


Yes, I definately agree with you that people should learn to write 
different ways so that it's all readable code.  I'm sure with time (--i 
-(-i)) could look pretty natural to me though it looks a bit odd at the 
moment.  I'm always looking to learn something new and not afraid to ask 
questions when I see something I don't understand.



James O'Reilly
www.jamesor.com



Steven Sacks | BLITZ wrote:

There has been extensive testing on this (search the archives) and it's
been proven to my satisfaction that pre-decrementated loops are
consistently faster than post-decremented loops, and specifically that
while (--i -(-1)) is faster than while (i--), less p-code or not.

To the point that it's more readable, that's like saying that you prefer
quarter notes instead of sixteenth notes when reading music.  Once you
write while (--i -(-1)) a bunch, you have no trouble reading it.  It's a
hell of a lot easier to read than the fastest for loop syntax.

for (var i = myArray.length; --i -(-1); ) {}

I mean, if you find inline conditionals or non-braced if statements hard
to read, does that mean you shouldn't write them or that you should
learn to write them so you can learn to read them.

I didn't like mustard when I was younger.  Does that mean I shouldn't
ever like mustard?   ;)

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

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


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

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


Re: [Flashcoders] Find item in array

2006-09-19 Thread JOR

Mike, that sounds very reasonable to me.

What I've been able to ascertain is reading and writing to the register 
(in the case of (--i -(-1)) is significantly faster than reading and 
writing to a variable (in the case of (i--)) that the first case's 
additional instruction to subtract doesn't outweigh the gain.


I guess it's kind of like a Porsce 911 is so much faster than a Ford 
Festiva that adding baggage to a luggage rack to make up for the lack of 
storage won't slow it down enough to lose in a race.  Likewise, just 
because the extra instruction of subtraction adds another line of code, 
it doesn't mean it will run slower if the other lines can make up for it.


I wonder if there is a reference online that shows how many relative 
cycles each instruction takes compared to one another.  Aside from the 
one link for Flasm that Steven posted I haven't found much.  I guess I 
can compile a bunch of different tests using various statements like 
push and setVariable and see the performance of each.  I'm sure this 
has been done to death so I'd rather just read the findings.  I guess 
this is my punishment for getting art degrees.


Now whether I would use (--i -(-i)) over (i--) in practice is a 
different issue.  My guess is I would use the former if FPS was a real 
concern and the later if readability was more of a priority.


James O'Reilly
www.jamesor.com



Mike Keesey wrote:

My guess would be that postincrement it takes longer because it needs to
store and return the original value, while preincrement only needs to
return the result after performing the operation. But that's only a
guess.

―
Mike Keesey


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

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


Re: [Flashcoders] Find item in array

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


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


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


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


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


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



Steven Sacks | BLITZ wrote:

using a for..i..in loop will always be faster



It's been proven before here on flashcoders that for in is not faster
than --a -(-1) because it compiles to more lines of pcode.  I guess it's
time to use Flasm to bust out some pcode and post it here on the list
instead of making claims based on hunches and past posts in the
archives.

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

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


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

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


Re: [Flashcoders] For and Var

2006-09-18 Thread JOR
I think Laurent was trying to cast the value of a variable with a 
dynamic name to a number and not the dynamic name s+i to a number 
which can be done like this:


// assuming flashSQL.MoveNext[var8+i] can be cast to a number
// you can do it like this
this[s+i] = Number( flashSQL.MoveNext[var8+i] );

However, the text property of a textfield takes a string value, not a 
number value so casting to a number is inappropriate for the .text 
assignment.


Hope this helps,
James

James O'Reilly
www.jamesor.com


Merrill, Jason wrote:

//var [s+i]:Number = flashSQL.MoveNext[var8+i];
//Number([s+i]);

That's like black magic or something.  Several things wrong there.  You
need to learn to use some traces in your code to know where it's
breaking, but basically, the array access operator is used to evaluate
an object name in an object.  So in other words, you need to use the
proper scope

this[rec+i]

Means (on a frame script), the current timeline: rec1 instance, rec2
instance, rec3 instance, etc.

Also, name your instances starting with 0 instead of 1, will be easier
for you since arrays start at 0.

for (var i = 0; i7; i++) {
var myTempNumber:Number = //whatever  you do to get the number
 this[rec+i].text = myNumber
}

Also, s+Something will never be a number - no numbers I know of start
with s. 


Hope that helps,

Jason Merrill
Bank of America 
Learning  Organization Effectiveness - Technology Solutions 
 


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

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


Re: [Flashcoders] Find item in array

2006-09-18 Thread JOR


Merrill, Jason wrote:

 while (--i -(-1)) {



Jason, very interesting way of counting through the array.  I haven't 
see this approach before.  Are there any benefits to using (--i -(-i)) 
in the expression over something like the following?:


while (i--) {

It seems like your loop would need to do two calculations each trip. 
One for decrementing i and the second for adding 1 to it to keep the 
number above zero so it returns true.  If you decrement i after the 
condition using i-- instead of before the condition with --i you won't 
need add 1 to it.  Just an idea.


However, as far as I know you're right looping through the array in AS 
2.0 is the only way to find the index of an item.  You might also want 
to use === instead of == to do strict comparing so 12 doesn't equal 
12.  Depends on what you need tho.


One thing I might add to your function is the ability to return -1 
instead of undefined when an item isn't found which is more consistent 
with the String.indexOf method.


Thankfully, in AS 3.0 there is a method to find the index and as fate 
would have it it's called indexOf().  It returns either the index if 
found or -1 if not found.  You would use it like:


var idx:Number = a.indexOf(d);

Cheers,
-- James


James O'Reilly
www.jamesor.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


Re: [Flashcoders] Find item in array

2006-09-18 Thread JOR

Steven Sacks | BLITZ wrote:

It's the fastest because:

Pre-decrementation (--i) is faster than post-decrementation (i--)


I don't see why that would be.  Both var i=1;i--; and var i=1;--i; 
compile down to the exact same 8 lines of p-code:


 _constantPool i
 _push i 1
 _var
 _push i i
 _getVariable
 _decrement
 _setVariable
 _end

So i don't see how one can be faster than the other.  Maybe in other 
languages this is the case?




And substraction (- (-1) is faster than addition (+ 1).



I ran numerous tests using loops of 1 million on this but was unable to 
conclude one way or the other because roughly half the time one method 
was faster than the other.  differences ranged from 1 millisecond to 175 
milliseconds in both directions.  My only take on my results is that 
they are at least negligably similar.



They are faster because it's less code that gets produced when you
compile.
http://flasm.sourceforge.net/#optimization



This isn't true.  (i--) is one less line of p-code (and 9 less bytes of 
data) than (--i -(-1)) because it isn't doing the extra calculation of 
subtraction like I mentioned in my email.  Take a look at the p-code:


var i:Number = 1;
while (i--) {
  trace(i);
}

_constantPool i
_push i 1
_var
#4  _push i
_getVariable
_push i i
_getVariable
_decrement
_setVariable
_not
_if true goto #16
_push i
_getVariable
_trace
_jump to #4
#16 _end

--
var i:Number = 1;
while (--i -(-1)) {
  trace(i);
}

_constantPool i
_push i 1
_var
#4  _push i i
_getVariable
_decrement
_storeRegister 0
_setVariable
_push register0 4294967295
_subtract
_not
_if true goto #17
_push i
_getVariable
_trace
_jump to #4
#17 _end



For most cases, it's a matter of milliseconds or even less, which isn't
that big a deal, but I use it anyway because it's a good habit to have
and it makes my code logic work with that in mind always so when it does
make a difference in seconds, it's already there.



I agree about it not being a big deal, but I prefer the (i--) method 
over (--i -(-1)) since I find it easier to read.


-- James


James O'Reilly
www.jamesor.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] Job postings ok?

2006-09-07 Thread JOR

// taking into account false evaluation of the expression
offTopic = (!codeRelatedPost);

LOL, just trying to figure out a way (albeit a stretch) to get this 
thread on-topic. ;)


James O'Reilly
www.jamesor.com


Mike Britton wrote:

I'm surprised people are ok w/ job posts here.

if (!codeRelatedPost)
   offTopic = true;

Can a FlashJobPosts list be started?  Job posts show us options, sure,
but they aren't about code, they are about jobs.


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] OOP methodology and flash. I'm loosing my faith...

2006-08-31 Thread JOR
To quote the first line of the web page you reference: In more precise 
terms, polymorphism (object-oriented programming theory) is the ability 
of objects belonging to different types to respond to method calls of 
methods of the same name, each one according to an appropriate 
type-specific behaviour.


Even though sub-classing is one way to achieve similar interfaces, it's 
also common to use interfaces depending on your needs.


interface Bar {
  function toString() {}
}
class Foo implements Bar {
  function toString() { trace(I'm Foo); }
}
class Goo implements Bar {
  function toString() { trace(I'm Goo); }
}
var objs:Array = new Array(3);
objs[0] = new Foo();
objs[1] = new Goo();
objs[2] = 12345;

// The following is an example polymorphism.  You are
// calling the same method on multiple objects regardles
// of their type because they all have a method with the
// name toString() but perform type-specific behaviour
trace( objs[0].toString() );
trace( objs[1].toString() );
trace( objs[2].toString() );

James O'Reilly - JOR
www.jamesor.com


Jeroen Beckers wrote:

You can't 'choose' the definition of polymorphism :p.

In simple terms, *polymorphism* lets you treat derived class members 
just like their parent class's members.
Source: 
http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming 
(+ all my java  AS books)


class Foo extends Bar
{

}

var myFoo:Bar = new Foo(); //this is polymorphism !

Giles Taylor wrote:


http://en.wikipedia.org/wiki/Polymorphism_(computer_science)
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Meinte
van't Kruis
Sent: 25 August 2006 14:14
To: Flashcoders mailing list
Subject: Re: [Flashcoders] OOP methodology and flash. I'm loosing my
faith...

well, I get Interfaces, but thanks for explaining :).

I just don't think actionscript, or java, has any polymorphism, since
the definition of that is, in my opinion, a class having more than one
parent class (ie, can extend 2 or more classes), which isn't the case.
So I don't understand why people who are explaining oop in actionscript
talk about polymorphism, because it just isn't there :), but perhaps I'm
wrong.

cheers,
-Meinte
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] help in storing value

2006-08-31 Thread JOR
Let's see a code sample of what you are doing with loops to better 
understand your question.



James O'Reilly - JOR
www.jamesor.com




Rutul Patel wrote:

hi guys,
I am using Array to store value and its drive me crazy to get back all that
value,
because i have like 10-15 array to store different values and i also 
have to

compare
two array  so i have to use for loops..so i m using like so many for 
loop in

my
program and sometimes its giving me weird output.

so i want to know if there is any way to store value and it can get
retrieve easy i mean in less loop.

if anybody know any tutorial for this it will really help me out.

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] [OT] Friday Mental Break

2006-08-25 Thread JOR




Claus Wahlers wrote:



http://www.dopelogik.com/flash/snakes_in_a_class/



this._snakes.push( snake ); // BUG!
Cheers,
Claus.



Yeah, I don't know that I'd push a snake either.  slice a snake perhaps. :-P

He probably meant to assign the snake var inside of the switch statement 
instead of push both inside the switch and again after it.  I'd probably 
also move the quotes assignment to the constructor so it isn't 
reassigned with every reciteCheesyLine() call.


Either way, compile or no compile, it was very funny. Thanks for the 
laugh dopelogik!


JOR
www.jamesor.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: Junior Developer Flash/Flex Salary?

2006-06-20 Thread JOR
I had a situation were my hourly rate was roughly three times the hourly 
rate a particular company was use to paying for Flash work.  They wanted 
me to come down in price and by a lot whereas I felt I was already a 
bargain.


It was a short four week project and feeling confident in my 
capabilities I suggested something he hadn't heard before.  I offered to 
work for them 2 days for free.  If at the end of the two days they were 
unhappy with my work they could say no thanks and owe me nothing. 
However, should they want me to stay past the two days I get my asking 
rate for those two days already worked and continued for the remainder 
of my stay.  They were comfortable with the offer and agreed.  I was 
very confident in my capabilities so I felt it was a low risk offer.  As 
it turned out, they asked me to stay an additional two weeks past the 
original four and they couldn't be happier.


If you feel you are worth the rate you are asking, you shouldn't lower 
it.  If for some reason you feel it's your only option I would recommend 
creating your invoice at your proper rate with a discount line at the 
bottom so they get use to seeing your correct hourly rate.  Removing a 
first project discount (or something of the sort) in the future is a 
heck of a lot easier than trying to raise your hourly rate.


Good luck,
James





Kevin Mulvihill wrote:
$11/ hr accepting that is part of the reason why people think 
they can pay developers peanuts



Here, here. 


Denver is a big city comparable to L.A., where I am. And in this city, bag
boys at grocery stores are making $11/hr. Even way back in '97 when I was in
my last corporate job, it was costing us $15/hr. just to have a temp come in
and put papers in a filing cabinet. Is that how you see yourself? As
unskilled labor???

Now if the idea is just that the guy wants to check you out and make sure
you can do the work, then I might give him a few DAYS at $11/hr. and then
revert to an honest pay scale if he wants to keep you... And this assumes
that you don't have any references or much in the way of code samples to
share.

The real question then becomes 'how long is it going to take to get you up
to speed?' If the guy is thinking several months, then you would clearly be
foolish to accept that offer. If you don't respect yourself, no one else
will either... And your getting 'up to speed' could take a very long time
indeed.

Kevin

 




___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/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] generating documentation

2005-12-20 Thread JOR
I've been using AS2DOC which works pretty well so far.  It creates both 
traditional HTML/DOC files as well as Flash Help files as MXP extensions 
you can install into Flash.


Someone on the list mentioned development on it has stopped a while back 
tho.



JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net



ryanm wrote:
   I've used a number of different auto-documentation generators before, 
but not with actionscript. I was wondering what everyone was using, if 
AS2Doc was the defacto standard, or if there are others that are as good 
or better for documenting actionscript. I'm tasked with writing a coding 
and documentation standard for Flash developers (and recommending a 
documentation app) for my company, so I thought I would see what is out 
there before I go making any decisions.


   Any recommendations or warnings about specific software are appreciated.

ryanm
___
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] HTML in XML

2005-12-07 Thread JOR

You want to use .nodeValue when accessing CDATA or the data will be escaped.

JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net



Mike Boutin wrote:

I am bring in some html text to show in flash in an xml file like this:


description id=0
   title![CDATA[bpicture 0/b]]/title
/description

When i trace it back in flash, it shows up like this:

lt;bgt;picture 0lt;/bgt;

How can I keep it show it shows the html tags because it wont show up in 
flash as bolded...




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


[Flashcoders] Disabling F5 Key

2005-11-28 Thread JOR

Is there a way to trap and disable the F5 key when Flash has focus?

I have the javascript in place to prevent this on the rest of the html 
page but when the Flash movie has focus and F5 is pressed IE refreshes.


I've tried removing the keyListener inside the onKeyDown handler but 
that doesn't stop the event from bubbling out to the browser.



JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net

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


Re: [Flashcoders] Using Listeners to instantiate onEnterFrame SOLVED

2005-11-22 Thread JOR

If you didn't want to hard code the paths you could do this:

public function handlePressedUP(){
theBall.onEnterFrame = function () {
  _y -= 5; // Move ball by 5 px.
}
}

JOR

___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net



Steven Loe wrote:

Solved. Was just a path-to-object problem. Changing the code to this takes care
of it:

public function handlePressedUP(){
trace(function);
_level0.Ball.onEnterFrame = function () {
_level0.Ball._y -= 5;
}
}
}

Thanks!
-Steven Loe


--- Hans Wichman [EMAIL PROTECTED] wrote:



Hi,
in your example i think it would have to be:



   public function handlePressedUP(){
   this.onEnterFrame = function () {
   theBall._y -= 5; // Move ball by 5 px.

   }
   }


greetz
Hans


At 06:56 PM 11/22/2005, Steven Loe wrote:


I'd like to use a listener to instantiate an onEnterFrame when a keyDown
occurs.

In the code below, it seems that the the onEnterFrame
exists but ball dosen't move across the stage.
Is there a better way to approach this?
-Steven Loe


My code:

code on frame 1 of fla 

var myBall:Ball = new Ball(this, 4);
var keyListener_obj:Object = new Object();

keyListener_obj.onKeyDown = function() {
   switch (Key.getCode()) {
   case 38 : // Key: UP ARROW
   myBall.handlePressedUP();
   break;
   }
};
Key.addListener(keyListener_obj);



class Ball

class Ball extends MovieClip {
   var theBall:MovieClip;
   function Ball(target, depth) {
   theBall = target.createEmptyMovieClip(Ball, depth);
   theBall.attachMovie(Ball, b0, depth);
   }
   public function handlePressedUP(){
   function onEnterFrame() {
   theBall._y -= 5; // Move ball by 5 px.

   }
   }
}



___
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] File saved as 2004MX from 8 IDE causing 2004MX IDE crash

2005-11-09 Thread JOR

John Mark Hawley wrote:

Any ideas here?

Three FLAs saved as 2004 MX FLAs from the Flash 8 IDE have all of a sudden 
started crashing the 2004 MX IDE on export.  Occasionally, the player itself is 
crashing when the resulting SWF is played in a browser afterwards. Things are 
haywire.

Playing with the debugger, the crash always happens in a function that does 
very simple XML traversal, one cloneNode, and the deletes the XML traversed. 
The same FLA works fine in the Flash 8 IDE.

The IDE crash error messages vary -- sometimes unlimited recursion is reported, 
then an authplay.dll crash closes the IDE...sometimes things just freeze up, 
then a crash message pops up -- but clicking 'Debug' or 'more info' just 
enhances the crash a bit and closes the IDE.

Any clues here as to what's going on? We've has some of our team working in 8 
for two weeks and others in 7, all working ont he same files, and only 
yesterday has this nightmare appeared.  It wouldn't be so terrible if it didn't 
look like our SVN has somehow gone on the fritz...

-Mark Hawley

--
John Mark Hawley
The Nilbog Group
773.968.4980 (cell)

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




I've had a swf developed in MX 2004 keep crashing in a browser after I 
installed Flash 8.  I continued to develop in MX 2004 and publish for 
player 7 but it kept crashing.  As soon as I uninstalled Flash 8 and the 
Flash 8 plugin, MX 2004 began publishing stable swfs again.  Sucks 
because I'm afraid to install Flash 8 until my project is over.


JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net

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


Re: [Flashcoders] File saved as 2004MX from 8 IDE causing Flash 7 IDE crash

2005-11-09 Thread JOR


Machines with just the F7 plugin (no IDE at all) had my swf crashing in 
their browser.


When I compiled the swf for F7 using MX 2004 I had F8 installed also.  I 
think MX 2004 must have used some shared F8 libraries or something 
during publishing.  The swf ran without problems in the F8 plugin but in 
the F7 plugin it would crash every time.  I uninstalled F8 on my 
machine, republish the swf in MX 2004 and the crash went away.


Maybe one or more of your swfs are being created in MX 2004 on a machine 
that has the F8 plugin or IDE installed.  I think this causes playback 
problems for swfs running in the F7 plugin.


JOR



John Mark Hawley wrote:

I wish my problem was as simple to fix -- this is happening on machines that 
know nothing of Flash 8, and it has already tied up our team for a day trying 
to fix it to no avail.

The problem keeps jumping around, and some of us think it might be a stack 
problem -- there are a lot of loops in asynchronous calls.  I seem to be 
crashing out of a call to a SWF preloader that zips down an array of filenames 
and loads one at a time -- has the standalone/IDE player somehow changed the 
way SWFs load via movieCLipLoader in a way that makes it more touchy?

This just fell on us out of the blue after weeks of runnin' fine.

==

James O'Reilly wrote:

I've had a swf developed in MX 2004 keep crashing in a browser after I 
installed Flash 8.  I continued to develop in MX 2004 and publish for 
player 7 but it kept crashing.  As soon as I uninstalled Flash 8 and the 
Flash 8 plugin, MX 2004 began publishing stable swfs again.  Sucks 
because I'm afraid to install Flash 8 until my project is over.


---

John Mark Hawley wrote:


Any ideas here?

Three FLAs saved as 2004 MX FLAs from the Flash 8 IDE have all of a sudden 


started crashing the 2004 MX IDE on export.  Occasionally, the player itself is 
crashing when the resulting SWF is played in a browser afterwards. Things are 
haywire.


Playing with the debugger, the crash always happens in a function that does 


very simple XML traversal, one cloneNode, and the deletes the XML traversed. 
The same FLA works fine in the Flash 8 IDE.


The IDE crash error messages vary -- sometimes unlimited recursion is 


reported, then an authplay.dll crash closes the IDE...sometimes things just 
freeze up, then a crash message pops up -- but clicking 'Debug' or 'more info' 
just enhances the crash a bit and closes the IDE.


Any clues here as to what's going on? We've has some of our team working in 8 


for two weeks and others in 7, all working ont he same files, and only 
yesterday has this nightmare appeared.  It wouldn't be so terrible if it didn't 
look like our SVN has somehow gone on the fritz...



-Mark Hawley

--
John Mark Hawley
The Nilbog Group
773.968.4980 (cell)



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


Re: [Flashcoders] Expandable banners

2005-11-09 Thread JOR

Juan Anzaldo wrote:

I have to make expandable banners,
What is the best practice for make good banners?
some links may help
:D







You need to find out who the publisher is going to be and what rich 
media types, tracking kits and sizes they support and work from there.


Check out Atlas' site for some more insite on how at least one publisher 
handles it.  You could also check out others like Double-click.


(Gallery is IE Only for some reason)
http://www.atlassolutions.com/enterprise/richmedia/gallery/
http://www.atlassolutions.com/enterprise/richmedia/equivalency/
http://www.atlassolutions.com/enterprise/richmedia/flashmtk/



JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net

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


Re: [Flashcoders] Remoting with AMFPHP vs. ASP

2005-11-09 Thread JOR

[EMAIL PROTECTED] wrote:

Main benifit is speed.

When you pass data in XML to and from flash in the manner you are you effectivly
passing a long string. The FLash player then has to parse that into an XML
object. Now for smaller XML strings this is very quick, but lets say you have an
XML object with several hundred - even thousands of nodes.

Not only will this take a while to transfer, but Flash will also chug on
parseing it.

Thats where remoting comes in.

Reoting allows ue to flash data in purse binary form, and as native Flash
objects. So if you have a script on your server that extracts some records from
SQL into XML, you can pass that XML to Flash as a native XML object - NOT a
string. The result is when this is transfered to flash - the player has to do
nothing. It's already a native flash XML object - theres no need to parse it.

It's obviously not restricted to XML - you can pass recordsets, customer
objects, any type of data you like, and flash will send and recieve actual
objects not string representations of.

In a large scale application with major traffic (think backsing apps) this not
only offers an added level of security, but also will save serious $$$ on
bandwidth costs.

Pete




That sounds sweet then.  Thanks for the run-through.

JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net

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


Re: [Flashcoders] gotoAndStop(..); then accessing a movieclip.

2005-11-08 Thread JOR
Let the MC hold the state of the money and the dynamic text field 
reference it when needed since it doesn't persist.


In the MC declare the var:
var money:String;

Then set the dynamic text field's var to money

To make the change:
MC.money = $100;
MC.gotoAndStop(remote);


JOR




[EMAIL PROTECTED] wrote:
Let's say you have a MC with 2 frame labels (localPlayer and 
remotePlayer for example) and then you have different movie clips 
inside that MC. Something like this:


  |local|remote___
ammo  |x|
life  | |x
money | |x


Then you want to do something like this in your AS code (assuming you've 
previously stopped on local):


gotoAndStop(remote);
money.amount.text = $100;

This wouldn't work because you have to wait one frame before you'd be 
able to access money but what's your prefered way of waiting one frame? 
Is there a real easy way to do it without putting AS code in your 
timeline and without using setInterval(..) to wait one frame?


I hope I've just missed something that's real easy in flash.

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




--


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net

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


[Flashcoders] Flash app as a listener?

2005-11-07 Thread JOR
I'm just about to start a new application and I wanted to see people's 
thoughts on receiving info from the server.


I have a flash app where I want to lock an internal flash form from 
editting while another remote user is editting it.


I plan on making an XML call every few seconds to get the application's 
state which should work just fine.


Is there a better way?  Is there a way to register the flash app as a 
listener and sit back and wait for a broadcast from the server should my 
form be released for editting?  Keep in mind, I'm using just Flash 7 
without Communication Server or Flex.



JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net

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


Re: [Flashcoders] secure png

2005-11-07 Thread JOR


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Maxime
Sent: Monday, November 07, 2005 6:05 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] secure png

The goal of the client is to customize an image with a lot of 3d 
rendered png alpha layers. They don't care if the competitors do a 
screen capture, they don't want their competitors to know how they treat 
the image(alpha) for the layering of images.




Does it need to be composited in Flash?  Maybe Flash can send the server 
compositing information and then you have a server based app that 
composites the image and puts it into a folder for flash to import and 
returns to Flash the composited png's url.



JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net

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


Re: [Flashcoders] Help For Custom Components

2005-11-03 Thread JOR

Gregory_GOusable wrote:

In MX 2004, you can write the help in form of HTML files (number of
files) instead of reference tag in customactions.

Then, add the tag for each html file to your .mxi like that:
file source=_your_path_/file_name.html
destination=$flash/HelpPanel/Help/_your_folder_ /

See Extending Flash Help Panel Content article in Flash
Documentation on MM site.
Also, I'd recommend just download any component (for Flash MX 2004)
and look through it's content, mxi etc.




I just bought AS2DOC and it's awesome at creating Flash documentation 
files.  I just ran it on a couple of packages I had recently written 
with JavaDoc style commenting and in a matter of seconds it created 
detailed help docs and an mxi file for me.  I packaged the mxi file into 
an mxp and installed it into Flash.  After looking through the docs I 
see I left some comments out so I'm going to use it as a reference to 
where to go back to my classes and add more information to fill out the 
pages more.


Pricey but great product.  Highly recommended.  Unfortunatley their free 
trial version does not do Flash help files.


JOR



___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net

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


Re: [Flashcoders] Flash and ASP/MSSQL

2005-11-01 Thread JOR

Amanda Kuek wrote:

Thanks James. It's a good idea, but I think for this project I'll go
with the Javascript sets hidden form fields idea. But thanks for
adding this idea to my spongey brain!




Yeah I like the JavaScript method too.  One thing you might might to do 
is have a message for people who have JavaScript disabled.  Something 
like noscriptThis form requires the use of JavaScript.  Please make 
sure you are using a browser that supports JavaScript and has it turned 
on./noscript




JOR



___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net

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


Re: [Flashcoders] JavaDoc in as2

2005-10-31 Thread JOR

Doug Miller wrote:

http://java.sun.com/j2se/javadoc/writingdoccomments/



 On Mon, 31 Oct 2005, Martin Klasson
([EMAIL PROTECTED]) wrote:



Hi People.

I have been reading about the JavaDoc, and that is really what


I will


implement into my documentation-routine.

But now when I know all the tags and so on, I don't know what


is a


general good way to use for params and how to really actually


turn


javadoc into a good use within the AS-class.

Is there any good basics out on some simple sites? I cant


really find it


myself though googling and searching.

Thanks.



What are you running to produce the HTML documentation, the JavaDoc app 
itself?  It will work with .AS classes and packages?


I've already added all the documentation comments to my .AS files but 
that's as far as I got.  I was looking for a way to then transform those 
comments into actual HTML documentation but haven't tried JavaDoc yet. 
I didn't think it would read AS packages.



JOR



___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net

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


Re: [Flashcoders] Flash and ASP/MSSQL

2005-10-30 Thread JOR
Well, since you're using ASP you can take advantage of the Session 
object by storing the input from the flash movie in a session until the 
user submits the form.


In your Flash movie you would POST your X,Y variables to an ASP script 
which in turn stores them as Session(X) and Session(Y) or however 
else you would like to name them.  The ASP then returns to Flash a 
response so that Flash knows the data was retrieved ok and can display 
some sort of success response.  I typically just do a 
Response.Write(OK) or NOTOK or in more complex scripts an actual 
error code.


Then on the HTML side your form submits it's data to your form handling 
ASP script as normal and the ASP uses the Session(X) and Session(Y) 
as normal.  If the session vars are empty you could return the user back 
to the form with a form incomplete message.  Or if everything is ok, 
processing the form, empty the session vars.


JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net




Amanda Kuek wrote:

Hello everyone,

This is a question about Flash in an ASP form which communicates with an
MSSQL db. I'm not really sure how to phrase the question, so I'm afraid that
I'll just have to explain the story.

Imagine an ASP page about faulty garments. Let's just say that if you had a
hole in your T-shirt, you could visit this page to report it. The page would
have normal HTML fields for name and email, and it would also have a SWF
with a picture of a T-shirt. The disgruntled hole-y user clicks on the
T-shirt to leave an X representing where the hole is. The form information
(including that of the hole location, in the SWF) is then submitted using a
normal HTML submit button and stored in the MSSQL db.

I spose my question is, is this scenario possible? Is it only possible to
store user-submitted information (in this case, the X,Y coordinates of the
hole) by clicking on a Send button WITHIN flash, or is there another way?
I'd like to avoid making a user explicitly submit the SWF information AS
WELL AS the form information.

Any ideas and comments much appreciated,

Thanks muchly,

Amanda.
___
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] Mouse notification when leaving a swf...

2005-10-30 Thread JOR

Richard Kilmer wrote:
In ActionStep Scott Hyndman has built a set of custom cursors.  This  is 
VERY

cool when you are over the swf but is there a way we can hide the
cursor when the real cursor leaves the swf?  Is there any  
notification of mouse exit?  This must not rely on javascript, but be  
intrinsic to Flash itself.


Thanks,

-rich



Create a button the size of the movie and place it on the bottom most 
layer.  Add a mouseRolledIn() and mouseRolledOff() call to every button 
in your movie.


var userLeftID:Number;

function mouseRolledIn():Void {
  // Called from every button and will
  // cancel the userReallyLeft call.
  clearInterval(userLeftID);
}
function mouseRolledOff():Void {
  // Called from every button and will
  // inform the movie that the user left after
  // waiting 200 milliseconds.
  userLeftID = setInterval(userReallyLeft, 200);
}
function userReallyLeft():Void {
  // Whatever you want
}

Basically, it tries to call the userReallyLeft() function on every 
button rollOut.  However, if you rollout of one button and into another 
it cancels the userReallyLeft() call.  userReallyLeft() only ever gets 
called if you roll off your movie.


I've been using this in banner ads where the number of buttons the movie 
contains are minimal so this solution was pretty manageable.


I'd be interestedin knowing if anyone came up with any other solutions 
to this.



JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net

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


Re: [Flashcoders] setInterval() and the trouble

2005-10-29 Thread JOR

At first glance it looks like you have a potential continuous loop issue?

stopwatchComplete()  questionComplete()  stopwatchComplete()  and 
so on if (id = questions.length)


Second is I don't see where id is defined in questionComplete() did 
you mean to type this instead:


   if ( questionId = questions.length )



JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net






Weyert de Boer wrote:

Hi Liam,

First of all I always have had trouble with those methods, never got it 
right. Always failed, I don't they dont like!


I imagine you're calling clearInterval with the appropriate interval 
ID upon
each quiz question submittal, and then afterwards recalling 
setInterval for
the new question? How does it fail the second time? Does it just never 
call

it again, or does it call the function at a different interval?

Well, I happen to have a resource xml file which get loaded prioer of 
each group of questions, once this group is readed a
method in the root timeline gets triggered which will determine what to 
do. This method will also trigger the method buildQuestion() when
required, this method will create a new instance of 
question-movieclip. After this part is done the function doStopwatch() 
is called:


function doStopwatch() {
  // 1second = 1000ms
   _root.stopwatchIntervalId = setInterval( _root.stopwatchComplete, 
3000 );

}

function stopwatchComplete() {
   clearInterval( _root.stopwatchIntervalId );
 // trigger the question completed method
   _root.questionComplete( _root.question.id, _root.question.type );
}

function questionComplete( questionId, questionType ) {
   if ( id = questions.length ) {
// out of questions
_root.stopwatchComplete();
   } else {
 // next quesiton
 buildQuestion( questionId + 1 );
   }
}

IF you have a better solution please let me know! I feel so stupid that 
I don't get thing timer stuff working.


Yours,
Weyert de Boer


___
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] Obfuscation... Was: SWF Decompilers

2005-10-29 Thread JOR

I had an idea.  Not sure if it's a good one.

Flash is pretty good with optimizing all local var names to shorter ones 
like _1 and _2 which does make decompiled code a bit tougher to read.


What if I took it just a step further and in one or two of my main 
classes I added something like this:


/**
 * Fake function to deter decompiling
 * Function not actually used by class.
 **/
public var handleComputations () {
  // Maybe 10 or 20 lines of nonsensical but compileable
  // code using the local vars so that variable
  // names appear to be used inside this function but
  // this function isn't actually ever called by the class.
  // Maybe use uncommon routines with some bit shifts
  // and complex mathmatical equations to make it look scary.
}

Overall it might make the swf 1KB or so bigger but might be worth it if 
it added a frustrating day or two to a decompiler especially if they 
don't figure out right away that the function is never called.


Any thoughts?

JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net




Mike Duguid wrote:

yep still works

On 10/28/05, Gregory [EMAIL PROTECTED] wrote:




Question:
BTW, anyone knows if __bytecode__() is supported in Flash 8 (I'm still
using MX 2004 Pro)?





___
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] Casting stage MCs as MovieClip yields null?!

2005-10-24 Thread James O'Reilly [JOR]

Hi Scott,

I don't know what your evalAppendedPath contained so I wrote my own to 
test your code.  Everything worked as expected for me so maybe you have 
a typo in your movie clip names or path.  I've uploaded an FLA if you 
want to take a look at my version: 
http://www.synergymedia.net/downloads/evalTest.zip


My code:

function evalAppendedPath (obj:Object, str:String):Object {
// Over simplified because I'm unsure what code
// you actually have in here.  This function could
// use error handling.
return eval( obj + . + str );
}

var result:Object = evalAppendedPath( my_mc, some.nested.clip );
trace( result );  // _level0.my_mc.some.nested.clip
trace( typeof( result )); // movieclip
var mc:MovieClip = MovieClip( result );
trace( mc ); // _level0.my_mc.some.nested.clip


Let me know if you find your problem,
JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net





Scott Whittaker wrote:

Hi there,

I have discovered what appears to be a bug in Flash (player 7): I have
a class method which takes an object and a path string in dot-notation
format, and evaluates the result of the combined path. e.g.

evalAppendedPath( my_mc, some.nested.clip );

would return the object result of: my_mc.some.nested.clip;

This is a general purpose method which can take any object as an
input, and the evaluated result could also be of any type, so the
method return type is always going to be Object.

This method works just fine, and is not the source of the problem.

The problem comes when I know what the expected return type is and I
need to cast it so that I can use it with strong typing. In every
case, casting the returned result works just fine, with the exception
of movieclips placed on the stage at authortime. For example:

var result:Object = evalAppendedPath( my_mc, some.nested.clip );
trace( result );  // _level0.my_mc.some.nested.clip
trace( typeof( result )); // movieclip
var mc:MovieClip = MovieClip( result );
trace( mc ); // null

But if I load an external swf asset, evaluate its path, and cast it,
the cast works and doesn't yield null.

Short of changing all my internal class references to type Object
instead of MovieClip (which could cause all sorts of problems trying
to mesh with other code) or loading all my assets externally (which
will cause load time issues) is there anything else I can do?

Thanks!

--

Scott Whittaker
Trilobyte Interactive
___
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] Problem with .as files

2005-10-24 Thread James O'Reilly [JOR]

Michael Klishin wrote:

I. Franklin wrote:


Hi list,

I have encountered a bizarre problem with the .as files in one of my
projects.
The problem is that when I make any updations to the class file and
compile, it is not getting reflected in the project and moreover even
when I comment all the scripts in that class file, it compiles perfectly
and publishes and all the commented script works!!!. Any idea why this 
could happen?



Use this extension to clear ASO cache:

http://www.macromedia.com/cfusion/exchange/index.cfm?extid=1016963view=sn111 






Sweet, there's an extension!  I was thinking about writing a JSFL 
command to delete those aso files but this saves me the trouble.  Boy is 
it a pain to keep that folder open and delete the files manually before 
each publish.  Can't believe Macromedia hadn't thought of this??


JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net

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