[osflash] mtasc slower than IDE ???
Arnoud Bos
a.bos9 at chello.nl
Thu Jul 20 09:34:02 EDT 2006
Hi Ben,
Composition as you use is another valid option, but now you can't say
Ball._x = 10;
So you have to manually write all these move functions etc. yourself.
I like to do visual things with my Screen in the example. That's why I
extend the MovieClip class.
Arnoud
_____
Van: osflash-bounces at osflash.org [mailto:osflash-bounces at osflash.org] Namens
Ben Smeets
Verzonden: donderdag 20 juli 2006 14:43
Aan: Open Source Flash Mailing List
Onderwerp: Re: [osflash] mtasc slower than IDE ???
I for one, like to use the way the code reads itself. I wanted to be able to
say something like
class Ball
{
private var mcCanvas:MovieClip;
public function Ball(mcTarget:MovieClip, strName:String)
{
mcCanvas = mcTarget.createEmptyMovieClip(strName,
mcTarget.getNextHighestDepht());
}
}
// Then us it like
var a:Ball = new Ball(_root, "myBall");
This works great. The only downside is that you have to add a destroy
function to your classes to clear the mcCanvas
_____
From: osflash-bounces at osflash.org [mailto:osflash-bounces at osflash.org] On
Behalf Of Arnoud Bos
Sent: donderdag 20 juli 2006 13:33
To: bjorn.schultheiss at qdc.net.au; 'Open Source Flash Mailing List'
Subject: Re: [osflash] mtasc slower than IDE ???
Hi Bjorn,
I like the
var goal:MovieClip = target.createEmptyMovieClip(name, depth);
goal.__proto__ = Screen.prototype; // redirect objects
prototype chain
goal.__constructor__ = Screen; // assign new
constructor to the object
hack cause it makes refactoring easier. Say I want to rename the Screen
class, I can do it with a replace in files.
If I add the class to a lib symbol in the Flash IDE I'd have to change a
class name in the Flash ide as well when refactoring.
And in my case I don't even need a lib symbol at all. But it's hacky I must
admit.
I really like the
if( depth == undefined) depth = parent.getNextHighestDepth();
If( name == undefined) name = SYMBOL_NAME + depth;
part though. Simple but I didn't came up with it :-).
Arnoud
_____
Van: osflash-bounces at osflash.org [mailto:osflash-bounces at osflash.org] Namens
Bjorn Schultheiss
Verzonden: donderdag 20 juli 2006 8:50
Aan: 'Open Source Flash Mailing List'
Onderwerp: Re: [osflash] mtasc slower than IDE ???
Yes it seems like a bit of a hack, here's how i have been creating movieclip
instances for a while.
usage:
var loadDataset:LoadCrmUI = LoadCrmUI.createInstance( timeline, 45,
'LoadCrmUI_mc' ).init( 0, 0 );
class
class com.qdc.UI.panels.LoadCrmUI extends MovieClip
{
/*
_________________________________________________________
// Constructor
_________________________________________________________
*/
public static function createInstance( parent:MovieClip, depth:Number,
name:String ) : LoadCrmUI
{
if( depth == undefined) depth = parent.getNextHighestDepth();
if( name == undefined) name = SYMBOL_NAME + depth;
return LoadCrmUI( parent.attachMovie( SYMBOL_NAME, name, depth));
}
public function init( x : Number, y : Number ) : LoadCrmUI
{
HashCodeCreator.initialize( this );
QDispatcher.initialize( this );
rm = RemoteManager.getInstance();
rm.addEventListener( 'ALL', this );
ds = DataStore.getInstance();
return this;
}
Regards,
Bjorn Schultheiss
Senior Flash Developer
QDC Technologies
_____
From: osflash-bounces at osflash.org [mailto:osflash-bounces at osflash.org] On
Behalf Of Ben Smeets
Sent: Thursday, 20 July 2006 12:07 AM
To: Open Source Flash Mailing List
Subject: Re: [osflash] mtasc slower than IDE ???
Ah i see. I am missing the point, since why not let a Screen class extend
Movieclip and let it create a movieclip in it's constructor? But that's not
meant to be criticism though :) Everybody his/hers own way of solving
things. I always find it interesting to see other peoples solutions for
common problems.
Cheers, Ben
_____
From: osflash-bounces at osflash.org [mailto:osflash-bounces at osflash.org] On
Behalf Of Arnoud Bos
Sent: woensdag 19 juli 2006 15:51
To: 'Open Source Flash Mailing List'
Subject: Re: [osflash] mtasc slower than IDE ???
I don't know :-)
In my app i use screens. These are actually extended movieclips (I like to
move them around etc.)
But I don't want to make a library item of the Screen. All assets that go
into the screen
are made programmically (that's not an English word for sure :-))
NB the create function is a method of my screen class.
So I create an movieclip (by using a static factory method) and then I
reassign the
Prototype from movieclip to Screen as well as the constructor.
Finally I cast it to Screen.
And then I have a screen object with a visual representation on screen
without the
Need for a library representation of the Screen in the Flash IDE.
To be short, I like to keep as much of my apps in the code so that I don't
have to switch between Flash ide and
FlashDevelop when developing.
Btw th GDispatcher is needed to broadcast screen events to my GUI manager
that moves the screens around etc.
Hope that helps,
arnoud
_____
Van: osflash-bounces at osflash.org [mailto:osflash-bounces at osflash.org] Namens
Ben Smeets
Verzonden: woensdag 19 juli 2006 10:10
Aan: Open Source Flash Mailing List
Onderwerp: Re: [osflash] mtasc slower than IDE ???
Looks interesting... but what does it do exactly?
Grt, Ben
_____
From: osflash-bounces at osflash.org [mailto:osflash-bounces at osflash.org] On
Behalf Of Arnoud Bos
Sent: dinsdag 18 juli 2006 14:34
To: 'Open Source Flash Mailing List'
Subject: Re: [osflash] mtasc slower than IDE ???
Hi Martin,
Strange, cause i use delegates al the time as well as event dispatching.
Also the project has 30+ classes with some 1000 rules of code in them.
What I do use is the prototype hack like:
(this is the create function in my Screen class)
public static function create(target:MovieClip, name:String, depth:Number,
visible:Boolean) : Screen {
// create the visual representation of the screen.
// uses a hack to prevent needles library assets
with linkage is's or classes attached
var goal:MovieClip =
target.createEmptyMovieClip(name, depth);
goal._visible = visible;
goal.__proto__ = Screen.prototype; // redirect
objects prototype chain
goal.__constructor__ = Screen; // assign
superclass constructor to the object
var instance:Screen = Screen(goal); // force
right class
GDispatcher.initialize(instance); //
make dispatcher
return instance;
// return the instance
}
This I use in many classes that have a visual representation.
Maybe there is something in this code MTASC doesn't like too much.
It does work however :-)
Thanx,
Arnoud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/osflash_osflash.org/attachments/20060720/ca1b6288/attachment-0001.htm
More information about the osflash
mailing list