Composite Flash Graphics with HaXe

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Composite Flash Graphics with HaXe

jlm@justinfront.net
I have started a tutorial on my preferred approach to haXe flash  
development, I have tried this approach commercially in AS3 and have  
made some experiments in haXe (haxeloading).  Since it is quite a  
complex subject so far I have only discussed the approach and have not  
included code.

While I am aware it may not suit everyone I think it has merits and I  
would be interested in opinions on the finer aspects of  
implementation, if you have a completely different approach it would  
be interesting if you added it as a contrast tutorial. I say this  
because some aspects of the work flow will not suit some people and it  
is just outlining an approach not suggesting it as the best.  So  
really I am interested in discussing maybe the details of the loosely  
structured controller if you used my general approach.  Also I may not  
always be clear or brilliant at writting so any comments on that.

http://haxe.org/doc/flash/compositeflashgraphicswithhaxe

Please bear in mind I have been thinking about this for awhile and  
realize it may go counter to some peoples code beliefs, but I am yet  
to see a work flow that suits a non hardcore code development.

Maybe it is not suited in the haXe flash section, but was unsure where  
to place it, I am aware it would be more useful if it included code,  
but not being the genius like some here I wanted some ideas,  
especially as I am going to see if I can use haXe on a commercial  
project.

Cheers

;j

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Composite Flash Graphics with HaXe

theRemix
Nice, i wonder why this is your preferred approach, and yet you didn't  
add any code. I wonder because is it that you haven't actually coded  
in this way before, or just that you haven't made a clean generic  
'framework' style construct where it would be understandable and  
implementable in the tutorial.

I construct haXe projects in a few different ways, one of which is a  
bit similar to how your tutorial explains.

concerning graphics. depending on a few factors such as size of  
project, resources required, end-product use, and team involvement...

1. I'll use swfmill to create my swf-lib
2. i'll use my own GraphicsLoader class to load external resources
3. I'll use the flash ide and export resources from the library,  
create instance names, and --gen-hx-classes

it really helps designers of graphic and motion assets to use the  
flash IDE, then send me their source .fla files, then i import the  
assets, into a single swf-lib for use.
i found this to be extremely efficient, since i can easily replace/re-
paste objects in the library for updates from artists.

for simpler projects, i find swmill to be the fastest for me to code  
and manage myself.

regarding MVC.
i would like to implement a nice clean MVC code architecture someday  
for a project, i just have never found it to be easier/faster to code  
from beginning to end [while trying to stay within the confines of the  
framework] than to just create the few simple classes that are usually  
needed for a project. although maybe i find MVC to be too much because  
my projects may not be big enough, i haven't had a project that needs  
more than a few weeks to complete.

that being said, if you were to expand on the tutorial to build a  
simple application (and yes, include code), i would be very interested  
to try it out.

thanks for the awesome tutorial,

-+> theRemix

On Aug 8, 2009, at 8:56 AM, Justin Lawerance Mills wrote:

> I have started a tutorial on my preferred approach to haXe flash  
> development, I have tried this approach commercially in AS3 and have  
> made some experiments in haXe (haxeloading).  Since it is quite a  
> complex subject so far I have only discussed the approach and have  
> not included code.
>
> While I am aware it may not suit everyone I think it has merits and  
> I would be interested in opinions on the finer aspects of  
> implementation, if you have a completely different approach it would  
> be interesting if you added it as a contrast tutorial. I say this  
> because some aspects of the work flow will not suit some people and  
> it is just outlining an approach not suggesting it as the best.  So  
> really I am interested in discussing maybe the details of the  
> loosely structured controller if you used my general approach.  Also  
> I may not always be clear or brilliant at writting so any comments  
> on that.
>
> http://haxe.org/doc/flash/compositeflashgraphicswithhaxe
>
> Please bear in mind I have been thinking about this for awhile and  
> realize it may go counter to some peoples code beliefs, but I am yet  
> to see a work flow that suits a non hardcore code development.
>
> Maybe it is not suited in the haXe flash section, but was unsure  
> where to place it, I am aware it would be more useful if it included  
> code, but not being the genius like some here I wanted some ideas,  
> especially as I am going to see if I can use haXe on a commercial  
> project.
>
> Cheers
>
> ;j
>
> --
> haXe - an open source web programming language
> http://haxe.org

--
haXe - an open source web programming language
http://haxe.org

smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Composite Flash Graphics with HaXe

jlm@justinfront.net
theRemix

I have implemented most aspects in haXe before, the concept is exactly  
same for AS3 I am toying with posting up AS3 and haXe versions to show  
the code is very similar.  In fact yesterday i moved some AS3 code and  
merging it with my haXe bits, so I now have a version, I probably need  
to refactor some names etc...and maybe change tutorial.  My main  
concern is that I am not a OOP expert and I am fairly sure that most  
flash developers rarely use composites as much as me, and many use  
serious pureMVC and similar.. but I am not overly convinced as these  
frameworks seem to require too much knowledge, but maybe my approach  
too, and maybe my approach is not good as sites get larger.  Also I  
guess the haXe and flash are not exactly the same but maybe that is  
not critical if they break up in the same ways.

I will try to post some code up but it takes time to make sure code is  
not project related etc... maybe have more time in couple of weeks.  
Might be able to share some code off list in the mean time.

Cheers

;j

On 11 Aug 2009, at 08:55, theRemix wrote:

> Nice, i wonder why this is your preferred approach, and yet you  
> didn't add any code. I wonder because is it that you haven't  
> actually coded in this way before, or just that you haven't made a  
> clean generic 'framework' style construct where it would be  
> understandable and implementable in the tutorial.
>
> I construct haXe projects in a few different ways, one of which is a  
> bit similar to how your tutorial explains.
>
> concerning graphics. depending on a few factors such as size of  
> project, resources required, end-product use, and team involvement...
>
> 1. I'll use swfmill to create my swf-lib
> 2. i'll use my own GraphicsLoader class to load external resources
> 3. I'll use the flash ide and export resources from the library,  
> create instance names, and --gen-hx-classes
>
> it really helps designers of graphic and motion assets to use the  
> flash IDE, then send me their source .fla files, then i import the  
> assets, into a single swf-lib for use.
> i found this to be extremely efficient, since i can easily replace/
> re-paste objects in the library for updates from artists.
>
> for simpler projects, i find swmill to be the fastest for me to code  
> and manage myself.
>
> regarding MVC.
> i would like to implement a nice clean MVC code architecture someday  
> for a project, i just have never found it to be easier/faster to  
> code from beginning to end [while trying to stay within the confines  
> of the framework] than to just create the few simple classes that  
> are usually needed for a project. although maybe i find MVC to be  
> too much because my projects may not be big enough, i haven't had a  
> project that needs more than a few weeks to complete.
>
> that being said, if you were to expand on the tutorial to build a  
> simple application (and yes, include code), i would be very  
> interested to try it out.
>
> thanks for the awesome tutorial,
>
> -+> theRemix
>
> On Aug 8, 2009, at 8:56 AM, Justin Lawerance Mills wrote:
>
>> I have started a tutorial on my preferred approach to haXe flash  
>> development, I have tried this approach commercially in AS3 and  
>> have made some experiments in haXe (haxeloading).  Since it is  
>> quite a complex subject so far I have only discussed the approach  
>> and have not included code.
>>
>> While I am aware it may not suit everyone I think it has merits and  
>> I would be interested in opinions on the finer aspects of  
>> implementation, if you have a completely different approach it  
>> would be interesting if you added it as a contrast tutorial. I say  
>> this because some aspects of the work flow will not suit some  
>> people and it is just outlining an approach not suggesting it as  
>> the best.  So really I am interested in discussing maybe the  
>> details of the loosely structured controller if you used my general  
>> approach.  Also I may not always be clear or brilliant at writting  
>> so any comments on that.
>>
>> http://haxe.org/doc/flash/compositeflashgraphicswithhaxe
>>
>> Please bear in mind I have been thinking about this for awhile and  
>> realize it may go counter to some peoples code beliefs, but I am  
>> yet to see a work flow that suits a non hardcore code development.
>>
>> Maybe it is not suited in the haXe flash section, but was unsure  
>> where to place it, I am aware it would be more useful if it  
>> included code, but not being the genius like some here I wanted  
>> some ideas, especially as I am going to see if I can use haXe on a  
>> commercial project.
>>
>> Cheers
>>
>> ;j
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
> --
> haXe - an open source web programming language
> http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Composite Flash Graphics with HaXe

Baluta Cristian
My workflow is something like this, i'm not using composition, like you:

- Main calls an initialization class that loads fonts, register fonts, load swfs with assets that are too large to embed in the application, or photos.
- after the initialization is completed i init the Pages class
- Pages is controlled by SWFAddress. For each page i have a function that analyzes the url and is either creating a new page, or updates an existing one.
- each page is a class that extends a template if the case, but every graphic is attached here or loaded from server here, i'm passing only the path from where to load.
- every class has a resize and a destroy method
- Few times i've implemented and admin panel directly in each page.

I never had a chance to study MVC but what i have is all i need. I also have a group of classes that is usable in each project like: RCPhoto, Read, SWFAddress, RCButton, FontManager, CoreAnimation. The majority of this ones have no package and they are placed in a separate folder than the project.

On Tue, Aug 11, 2009 at 11:57 AM, Justin Lawerance Mills <[hidden email]> wrote:
theRemix

I have implemented most aspects in haXe before, the concept is exactly same for AS3 I am toying with posting up AS3 and haXe versions to show the code is very similar.  In fact yesterday i moved some AS3 code and merging it with my haXe bits, so I now have a version, I probably need to refactor some names etc...and maybe change tutorial.  My main concern is that I am not a OOP expert and I am fairly sure that most flash developers rarely use composites as much as me, and many use serious pureMVC and similar.. but I am not overly convinced as these frameworks seem to require too much knowledge, but maybe my approach too, and maybe my approach is not good as sites get larger.  Also I guess the haXe and flash are not exactly the same but maybe that is not critical if they break up in the same ways.

I will try to post some code up but it takes time to make sure code is not project related etc... maybe have more time in couple of weeks.  Might be able to share some code off list in the mean time.

Cheers

;j


On 11 Aug 2009, at 08:55, theRemix wrote:

Nice, i wonder why this is your preferred approach, and yet you didn't add any code. I wonder because is it that you haven't actually coded in this way before, or just that you haven't made a clean generic 'framework' style construct where it would be understandable and implementable in the tutorial.

I construct haXe projects in a few different ways, one of which is a bit similar to how your tutorial explains.

concerning graphics. depending on a few factors such as size of project, resources required, end-product use, and team involvement...

1. I'll use swfmill to create my swf-lib
2. i'll use my own GraphicsLoader class to load external resources
3. I'll use the flash ide and export resources from the library, create instance names, and --gen-hx-classes

it really helps designers of graphic and motion assets to use the flash IDE, then send me their source .fla files, then i import the assets, into a single swf-lib for use.
i found this to be extremely efficient, since i can easily replace/re-paste objects in the library for updates from artists.

for simpler projects, i find swmill to be the fastest for me to code and manage myself.

regarding MVC.
i would like to implement a nice clean MVC code architecture someday for a project, i just have never found it to be easier/faster to code from beginning to end [while trying to stay within the confines of the framework] than to just create the few simple classes that are usually needed for a project. although maybe i find MVC to be too much because my projects may not be big enough, i haven't had a project that needs more than a few weeks to complete.

that being said, if you were to expand on the tutorial to build a simple application (and yes, include code), i would be very interested to try it out.

thanks for the awesome tutorial,

-+> theRemix

On Aug 8, 2009, at 8:56 AM, Justin Lawerance Mills wrote:

I have started a tutorial on my preferred approach to haXe flash development, I have tried this approach commercially in AS3 and have made some experiments in haXe (haxeloading).  Since it is quite a complex subject so far I have only discussed the approach and have not included code.

While I am aware it may not suit everyone I think it has merits and I would be interested in opinions on the finer aspects of implementation, if you have a completely different approach it would be interesting if you added it as a contrast tutorial. I say this because some aspects of the work flow will not suit some people and it is just outlining an approach not suggesting it as the best.  So really I am interested in discussing maybe the details of the loosely structured controller if you used my general approach.  Also I may not always be clear or brilliant at writting so any comments on that.

http://haxe.org/doc/flash/compositeflashgraphicswithhaxe

Please bear in mind I have been thinking about this for awhile and realize it may go counter to some peoples code beliefs, but I am yet to see a work flow that suits a non hardcore code development.

Maybe it is not suited in the haXe flash section, but was unsure where to place it, I am aware it would be more useful if it included code, but not being the genius like some here I wanted some ideas, especially as I am going to see if I can use haXe on a commercial project.

Cheers

;j

--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org



--
Băluță Cristian
http://ralcr.com
http://imagin.ro

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Composite Flash Graphics with HaXe

gershon
A Nice approach i think, is to use a middleman, much like how swfmill defines class linkange and a name for an instance, i use an xml parser and the Type.createInstance, to transform nodeNames to package\class with attributes as arguments. other small assets are embeded with swfmill....

Here's a small snippet, other than the scripting, which is irrealavent to this disccusion, it is really easy to implement:

<?xml version="1.0" encoding="iso-8859-1"?>
<haxegui:Layout name="Level5">

    <haxegui:Image name="background" src="assets/images/scene7.jpg" >
    <events>
        <script type="text/hscript" action="onLoaded">
        <![CDATA[
            this.addEventListener(flash.events.Event.COMPLETE,
            function(e) {
            this.setChildIndex(this.bitmap, 0);
            var r = this.bitmap.width / this.bitmap.height;
            this.bitmap.width = this.stage.stageWidth;
            this.bitmap.height = this.stage.stageHeight;               
            }, false, 0, true);
           
        ]]>   
        </script>
    </events>
        <haxegui:controls:AbstractButton name="Bat" x="-43" y="89">
            <haxegui:Image name="Bat" src="assets/images/bat.png" >
            <events>
                <script type="text/hscript" action="onLoaded">
                <![CDATA[
                    this.scaleX = .666;
                    this.scaleY = .666;
                ]]>   
                </script>
            </events>
            </haxegui:Image>
        </haxegui:controls:AbstractButton>
        <haxegui:controls:AbstractButton name="Snake" x="546" y="660">
            <haxegui:Image name="Snake" src="assets/images/snake.png" >
            <events>
                <script type="text/hscript" action="onLoaded">
                <![CDATA[
                    this.scaleX = .666;
                    this.scaleY = .666;
                ]]>   
                </script>
            </events>
            </haxegui:Image>
        </haxegui:controls:AbstractButton>
    </haxegui:Image>
</haxegui:Layout>


This one also relies on hscript, point being that i dont care what's inside the button, wheter static or animated, i can put stub graphics in there, mess around with the top-level class, and inject the new graphics without ever re-compiling...

         <haxegui:controls:AbstractButton name="Chair">
            <haxegui:Component name="Chair" x="288" y="350" >           
            <events>
                <script type="text/hscript" action="onLoaded">
                <![CDATA[
                    var loader = new flash.display.Loader();
           
                    var urlReq = new flash.net.URLRequest("assets/chair.swf");
           
                    loader.load(urlReq);
                   
                    function onComplete(e) {
                        var swf = this.addChild(e.currentTarget.content);
                        swf.scaleX = 2/3;
                        swf.scaleY = 2/3;
                    }
                    loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, onComplete);               
                   
                    ]]>   
                </script>
            </events>
            </haxegui:Component>
        </haxegui:controls:AbstractButton>


All this is not meant to work online, you can see there are'nt any Event.PROGRESS and such, it was part a desktop minigame...

This part of the haxegui framework, which is kind of a mxml rip-off, is considered stable, i use it daily, and it could be easily incoporated to other projects (well, once its on haxelib anyway)

I donno much about mvc, but i can compare this method to real-world construction of say a song, you've got the rhythm and chords "hard-coded" and ready for playback, and you just change the melody to suit it...

sorry for a long post, and have a great day.

On Tue, Aug 11, 2009 at 1:44 PM, Baluta Cristian <[hidden email]> wrote:
My workflow is something like this, i'm not using composition, like you:

- Main calls an initialization class that loads fonts, register fonts, load swfs with assets that are too large to embed in the application, or photos.
- after the initialization is completed i init the Pages class
- Pages is controlled by SWFAddress. For each page i have a function that analyzes the url and is either creating a new page, or updates an existing one.
- each page is a class that extends a template if the case, but every graphic is attached here or loaded from server here, i'm passing only the path from where to load.
- every class has a resize and a destroy method
- Few times i've implemented and admin panel directly in each page.

I never had a chance to study MVC but what i have is all i need. I also have a group of classes that is usable in each project like: RCPhoto, Read, SWFAddress, RCButton, FontManager, CoreAnimation. The majority of this ones have no package and they are placed in a separate folder than the project.


On Tue, Aug 11, 2009 at 11:57 AM, Justin Lawerance Mills <[hidden email]> wrote:
theRemix

I have implemented most aspects in haXe before, the concept is exactly same for AS3 I am toying with posting up AS3 and haXe versions to show the code is very similar.  In fact yesterday i moved some AS3 code and merging it with my haXe bits, so I now have a version, I probably need to refactor some names etc...and maybe change tutorial.  My main concern is that I am not a OOP expert and I am fairly sure that most flash developers rarely use composites as much as me, and many use serious pureMVC and similar.. but I am not overly convinced as these frameworks seem to require too much knowledge, but maybe my approach too, and maybe my approach is not good as sites get larger.  Also I guess the haXe and flash are not exactly the same but maybe that is not critical if they break up in the same ways.

I will try to post some code up but it takes time to make sure code is not project related etc... maybe have more time in couple of weeks.  Might be able to share some code off list in the mean time.

Cheers

;j


On 11 Aug 2009, at 08:55, theRemix wrote:

Nice, i wonder why this is your preferred approach, and yet you didn't add any code. I wonder because is it that you haven't actually coded in this way before, or just that you haven't made a clean generic 'framework' style construct where it would be understandable and implementable in the tutorial.

I construct haXe projects in a few different ways, one of which is a bit similar to how your tutorial explains.

concerning graphics. depending on a few factors such as size of project, resources required, end-product use, and team involvement...

1. I'll use swfmill to create my swf-lib
2. i'll use my own GraphicsLoader class to load external resources
3. I'll use the flash ide and export resources from the library, create instance names, and --gen-hx-classes

it really helps designers of graphic and motion assets to use the flash IDE, then send me their source .fla files, then i import the assets, into a single swf-lib for use.
i found this to be extremely efficient, since i can easily replace/re-paste objects in the library for updates from artists.

for simpler projects, i find swmill to be the fastest for me to code and manage myself.

regarding MVC.
i would like to implement a nice clean MVC code architecture someday for a project, i just have never found it to be easier/faster to code from beginning to end [while trying to stay within the confines of the framework] than to just create the few simple classes that are usually needed for a project. although maybe i find MVC to be too much because my projects may not be big enough, i haven't had a project that needs more than a few weeks to complete.

that being said, if you were to expand on the tutorial to build a simple application (and yes, include code), i would be very interested to try it out.

thanks for the awesome tutorial,

-+> theRemix

On Aug 8, 2009, at 8:56 AM, Justin Lawerance Mills wrote:

I have started a tutorial on my preferred approach to haXe flash development, I have tried this approach commercially in AS3 and have made some experiments in haXe (haxeloading).  Since it is quite a complex subject so far I have only discussed the approach and have not included code.

While I am aware it may not suit everyone I think it has merits and I would be interested in opinions on the finer aspects of implementation, if you have a completely different approach it would be interesting if you added it as a contrast tutorial. I say this because some aspects of the work flow will not suit some people and it is just outlining an approach not suggesting it as the best.  So really I am interested in discussing maybe the details of the loosely structured controller if you used my general approach.  Also I may not always be clear or brilliant at writting so any comments on that.

http://haxe.org/doc/flash/compositeflashgraphicswithhaxe

Please bear in mind I have been thinking about this for awhile and realize it may go counter to some peoples code beliefs, but I am yet to see a work flow that suits a non hardcore code development.

Maybe it is not suited in the haXe flash section, but was unsure where to place it, I am aware it would be more useful if it included code, but not being the genius like some here I wanted some ideas, especially as I am going to see if I can use haXe on a commercial project.

Cheers

;j

--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org



--
Băluță Cristian
http://ralcr.com
http://imagin.ro

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org