[Flashcoders] runtime instantiation

2008-10-28 Thread Jiri Heitlager
I know it is possible to instantiate a class at runtime, but one always 
needs to put in a concrete piece of code that forces the compiler to 
actually add the class to the swf. I am currently looking into using 
this technique to gain flexibility in an application, but the fact that 
I will always need to add concrete code to force the compiler seems to 
be counter productive.

Here is what I have.

interface aInterface

class abstractA impl aInterface

class injectedB extends abstractA
class injectedC extends abstractA

then I have a factory method that reads an xml file and instantitated a 
class based on the @reference node using getDefinitionByName()

class reference='injectedB' /

My idea is that I can in the future write  an new class injectedC and 
just add it to the xml list. But this won't work because I will always 
need to add something like this to var foo:injectedC = null to add the 
class to the compiler. Meaning I will always need to recompile.

Is there any way to get around this?

Jiri








artur wrote:

need to know a few things:

1 - can i render/export to QT an AS based animation that will be 40min 
long?
it will be incorporating an FLV ( soundtrack ) with Cuepoints..that will 
trigger different AS animations made from an XML file.
is there a chance that the animation and sound can become out of sync ( 
this has been known to happen with timeline based animations )


2 - the FLV will have over 10k cuepoints.
is there a way to Scrub through to the middle of the animation by 
giving an ID# to each CuePoint?

and then giving each XML node that same ID#?

then just create a simple textfield form and have the client enter that ID#
and the animation can Jump to that section of the animation ( for 
testing/previewing )


but then how can the client add/delete cuepoints in the FLV and have 
them be resorted numerically? so they can match the xml IDs?

im sure there is a clever  flexible solution out there..anyone?
thanks!

p.s. i need to do this in AS2..if possible.

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


Re: [Flashcoders] runtime instantiation

2008-10-28 Thread Ashim D'Silva
If you want to add a class in the future, you will definitely have to
recompile, because flash doesn't compile at runtime as far as I know.
But I have also looked for a way to simply import classes without also
having a var defined. It's not too big a deal, but it's an interesting
topic.

2008/10/28 Jiri Heitlager [EMAIL PROTECTED]:
 I know it is possible to instantiate a class at runtime, but one always
 needs to put in a concrete piece of code that forces the compiler to
 actually add the class to the swf. I am currently looking into using this
 technique to gain flexibility in an application, but the fact that I will
 always need to add concrete code to force the compiler seems to be counter
 productive.
 Here is what I have.

 interface aInterface

 class abstractA impl aInterface

 class injectedB extends abstractA
 class injectedC extends abstractA

 then I have a factory method that reads an xml file and instantitated a
 class based on the @reference node using getDefinitionByName()
 class reference='injectedB' /

 My idea is that I can in the future write  an new class injectedC and just
 add it to the xml list. But this won't work because I will always need to
 add something like this to var foo:injectedC = null to add the class to the
 compiler. Meaning I will always need to recompile.
 Is there any way to get around this?

 Jiri








 artur wrote:

 need to know a few things:

 1 - can i render/export to QT an AS based animation that will be 40min
 long?
 it will be incorporating an FLV ( soundtrack ) with Cuepoints..that will
 trigger different AS animations made from an XML file.
 is there a chance that the animation and sound can become out of sync (
 this has been known to happen with timeline based animations )

 2 - the FLV will have over 10k cuepoints.
 is there a way to Scrub through to the middle of the animation by giving
 an ID# to each CuePoint?
 and then giving each XML node that same ID#?

 then just create a simple textfield form and have the client enter that
 ID#
 and the animation can Jump to that section of the animation ( for
 testing/previewing )

 but then how can the client add/delete cuepoints in the FLV and have them
 be resorted numerically? so they can match the xml IDs?
 im sure there is a clever  flexible solution out there..anyone?
 thanks!

 p.s. i need to do this in AS2..if possible.

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




-- 
The Random Lines
My online portfolio
www.therandomlines.com
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] runtime instantiation

2008-10-28 Thread Steve Mathews
One way to do this is to compile the class into a swf that you load.
Essentially you are creating modules or dlls. You just have to handle
loading them yourself. I have been using the technique for a while on a
project and it works great.
Steve

On Tue, Oct 28, 2008 at 12:13 AM, Jiri Heitlager 
[EMAIL PROTECTED] wrote:

 I know it is possible to instantiate a class at runtime, but one always
 needs to put in a concrete piece of code that forces the compiler to
 actually add the class to the swf. I am currently looking into using this
 technique to gain flexibility in an application, but the fact that I will
 always need to add concrete code to force the compiler seems to be counter
 productive.
 Here is what I have.

 interface aInterface

 class abstractA impl aInterface

 class injectedB extends abstractA
 class injectedC extends abstractA

 then I have a factory method that reads an xml file and instantitated a
 class based on the @reference node using getDefinitionByName()
 class reference='injectedB' /

 My idea is that I can in the future write  an new class injectedC and just
 add it to the xml list. But this won't work because I will always need to
 add something like this to var foo:injectedC = null to add the class to the
 compiler. Meaning I will always need to recompile.
 Is there any way to get around this?

 Jiri








 artur wrote:

 need to know a few things:

 1 - can i render/export to QT an AS based animation that will be 40min
 long?
 it will be incorporating an FLV ( soundtrack ) with Cuepoints..that will
 trigger different AS animations made from an XML file.
 is there a chance that the animation and sound can become out of sync (
 this has been known to happen with timeline based animations )

 2 - the FLV will have over 10k cuepoints.
 is there a way to Scrub through to the middle of the animation by giving
 an ID# to each CuePoint?
 and then giving each XML node that same ID#?

 then just create a simple textfield form and have the client enter that
 ID#
 and the animation can Jump to that section of the animation ( for
 testing/previewing )

 but then how can the client add/delete cuepoints in the FLV and have them
 be resorted numerically? so they can match the xml IDs?
 im sure there is a clever  flexible solution out there..anyone?
 thanks!

 p.s. i need to do this in AS2..if possible.

 ___
 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] runtime instantiation

2008-10-28 Thread Ian Thomas
There is a way to do it - rather than update your code with a
reference, you can force the compiler to include it by using the
compiler option:

-includes Class [Class]

e.g. mxmlc Main.as -output Main.swf -includes com.pack.MyClass
com.pack.MyOtherClass

Obviously you still need to recompile - but you don't need to update
any .as or MXML files.

HTH,
   Ian

On Tue, Oct 28, 2008 at 7:13 AM, Jiri Heitlager
[EMAIL PROTECTED] wrote:
 I know it is possible to instantiate a class at runtime, but one always
 needs to put in a concrete piece of code that forces the compiler to
 actually add the class to the swf. I am currently looking into using this
 technique to gain flexibility in an application, but the fact that I will
 always need to add concrete code to force the compiler seems to be counter
 productive.
 Here is what I have.

 interface aInterface

 class abstractA impl aInterface

 class injectedB extends abstractA
 class injectedC extends abstractA

 then I have a factory method that reads an xml file and instantitated a
 class based on the @reference node using getDefinitionByName()
 class reference='injectedB' /

 My idea is that I can in the future write  an new class injectedC and just
 add it to the xml list. But this won't work because I will always need to
 add something like this to var foo:injectedC = null to add the class to the
 compiler. Meaning I will always need to recompile.
 Is there any way to get around this?

 Jiri








 artur wrote:

 need to know a few things:

 1 - can i render/export to QT an AS based animation that will be 40min
 long?
 it will be incorporating an FLV ( soundtrack ) with Cuepoints..that will
 trigger different AS animations made from an XML file.
 is there a chance that the animation and sound can become out of sync (
 this has been known to happen with timeline based animations )

 2 - the FLV will have over 10k cuepoints.
 is there a way to Scrub through to the middle of the animation by giving
 an ID# to each CuePoint?
 and then giving each XML node that same ID#?

 then just create a simple textfield form and have the client enter that
 ID#
 and the animation can Jump to that section of the animation ( for
 testing/previewing )

 but then how can the client add/delete cuepoints in the FLV and have them
 be resorted numerically? so they can match the xml IDs?
 im sure there is a clever  flexible solution out there..anyone?
 thanks!

 p.s. i need to do this in AS2..if possible.

 ___
 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