Re: [Flashcoders] ScrollRect and masking

2010-07-12 Thread Omar Fouad
What about extending movieClip and overriding the height property to return
the mask height

On Mon, Jul 12, 2010 at 12:14 AM, Glen Pike postmas...@glenpike.co.ukwrote:

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


Re: [Flashcoders] ScrollRect and masking

2010-07-12 Thread Omar Fouad
Well I will do as Glen suggested, the first option. In my custom class that
implements an IModuleConteiner interface, I will add a get
fixedHeight():Number function.

Thanks everyone for the help

On Mon, Jul 12, 2010 at 11:41 AM, Omar Fouad omarfouad@gmail.comwrote:

 What about extending movieClip and overriding the height property to return
 the mask height

 On Mon, Jul 12, 2010 at 12:14 AM, Glen Pike postmas...@glenpike.co.ukwrote:

 currentModule.myMask



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


Re: [Flashcoders] ScrollRect and masking

2010-07-11 Thread Glen Pike
You should possibly roll your own class which is the list + mask that 
reports it's height and width as that of the mask.


Alternatively, if you are feeling lazy, make the mask a symbol  give it 
an instance name in the IDE, or do it programmatically and access the 
width / height of that in your calculations, e.g.


currentModule.x = (stage.stageWidth * 0.5) - (currentModule.myMask.width *0.5)



Omar Fouad wrote:

No one?

On Thu, Jul 8, 2010 at 10:34 AM, Omar Fouad omarfouad@gmail.com wrote:

  

Thanks for the reply. I'm already doing that, as the list loads its data
upon added to stage


On Thu, Jul 8, 2010 at 8:25 PM, Ktu ktu_fl...@cataclysmicrewind.comwrote:



you could try positioning it before you add the 'list' to the displayList
of
the container.

Ktu;

On Thu, Jul 8, 2010 at 12:49 PM, Omar Fouad omarfouad@gmail.com
wrote:

  

Hello,

I'm working on some project where I have a big container Sprite and


based
  

on
what I need, I add some ui inside of it. Once I add this ui, and I make
sure
that everything is there on its place, I align this container sprite to


fir
  

in the center of my stage:

private var currentModule:Sprite; // the container

private function updateScreen(e:MouseEvent):void {
if(currentModule) { // when I switch to another module
 removeChild(currentModule);
currentModule = null; // clean it up
}

currentModule = new Sprite();
addChild(currentModule);
currentModule.addChild(children); //some children are added to
currentModule
 currentModule.x = (stage.stageWidth * 0.5) - (currentModule.width *0.5)


//
  

aligns horizontally
currentModule.y = (stage.stageHeight * 0.5) - (currentModule.height


*0.5)
  

//
aligns horizontally
}

Now assume I add to the currentModule, a masked list. What I mean is a
container that contains 100 list items one below the other, and a mask


that
  

shows just 5 items and the mask's height is 100.
stage alignment doesn't work properly because the currentModule height


is
  

not just 100 px (as the mask's height) but it is actually the real


height
  

that the 100 list item are occupying and so, alignment fails.

I could use myMask.height, but I need to align the whole currentModule


as I
  

use it as a wrapper to wrap some components under the same hood.
What should I do? I tried tracing the mc's height after using


scrollRect,
  

as
people said that it would return only the visible part's height but it
didn't happen. I traced and the same number is there as if nothing were
masked.
Any Ideas?

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



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

  


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

  

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


Re: [Flashcoders] ScrollRect and masking

2010-07-10 Thread Omar Fouad
No one?

On Thu, Jul 8, 2010 at 10:34 AM, Omar Fouad omarfouad@gmail.com wrote:

 Thanks for the reply. I'm already doing that, as the list loads its data
 upon added to stage


 On Thu, Jul 8, 2010 at 8:25 PM, Ktu ktu_fl...@cataclysmicrewind.comwrote:

 you could try positioning it before you add the 'list' to the displayList
 of
 the container.

 Ktu;

 On Thu, Jul 8, 2010 at 12:49 PM, Omar Fouad omarfouad@gmail.com
 wrote:

  Hello,
 
  I'm working on some project where I have a big container Sprite and
 based
  on
  what I need, I add some ui inside of it. Once I add this ui, and I make
  sure
  that everything is there on its place, I align this container sprite to
 fir
  in the center of my stage:
 
  private var currentModule:Sprite; // the container
 
  private function updateScreen(e:MouseEvent):void {
  if(currentModule) { // when I switch to another module
   removeChild(currentModule);
  currentModule = null; // clean it up
  }
 
  currentModule = new Sprite();
  addChild(currentModule);
  currentModule.addChild(children); //some children are added to
  currentModule
   currentModule.x = (stage.stageWidth * 0.5) - (currentModule.width *0.5)
 //
  aligns horizontally
  currentModule.y = (stage.stageHeight * 0.5) - (currentModule.height
 *0.5)
  //
  aligns horizontally
  }
 
  Now assume I add to the currentModule, a masked list. What I mean is a
  container that contains 100 list items one below the other, and a mask
 that
  shows just 5 items and the mask's height is 100.
  stage alignment doesn't work properly because the currentModule height
 is
  not just 100 px (as the mask's height) but it is actually the real
 height
  that the 100 list item are occupying and so, alignment fails.
 
  I could use myMask.height, but I need to align the whole currentModule
 as I
  use it as a wrapper to wrap some components under the same hood.
  What should I do? I tried tracing the mc's height after using
 scrollRect,
  as
  people said that it would return only the visible part's height but it
  didn't happen. I traced and the same number is there as if nothing were
  masked.
  Any Ideas?
 
  Thanks in advance
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



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


[Flashcoders] ScrollRect and masking

2010-07-08 Thread Omar Fouad
Hello,

I'm working on some project where I have a big container Sprite and based on
what I need, I add some ui inside of it. Once I add this ui, and I make sure
that everything is there on its place, I align this container sprite to fir
in the center of my stage:

private var currentModule:Sprite; // the container

private function updateScreen(e:MouseEvent):void {
if(currentModule) { // when I switch to another module
 removeChild(currentModule);
currentModule = null; // clean it up
}

currentModule = new Sprite();
addChild(currentModule);
currentModule.addChild(children); //some children are added to currentModule
 currentModule.x = (stage.stageWidth * 0.5) - (currentModule.width *0.5) //
aligns horizontally
currentModule.y = (stage.stageHeight * 0.5) - (currentModule.height *0.5) //
aligns horizontally
}

Now assume I add to the currentModule, a masked list. What I mean is a
container that contains 100 list items one below the other, and a mask that
shows just 5 items and the mask's height is 100.
stage alignment doesn't work properly because the currentModule height is
not just 100 px (as the mask's height) but it is actually the real height
that the 100 list item are occupying and so, alignment fails.

I could use myMask.height, but I need to align the whole currentModule as I
use it as a wrapper to wrap some components under the same hood.
What should I do? I tried tracing the mc's height after using scrollRect, as
people said that it would return only the visible part's height but it
didn't happen. I traced and the same number is there as if nothing were
masked.
Any Ideas?

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


Re: [Flashcoders] ScrollRect and masking

2010-07-08 Thread Ktu
you could try positioning it before you add the 'list' to the displayList of
the container.

Ktu;

On Thu, Jul 8, 2010 at 12:49 PM, Omar Fouad omarfouad@gmail.com wrote:

 Hello,

 I'm working on some project where I have a big container Sprite and based
 on
 what I need, I add some ui inside of it. Once I add this ui, and I make
 sure
 that everything is there on its place, I align this container sprite to fir
 in the center of my stage:

 private var currentModule:Sprite; // the container

 private function updateScreen(e:MouseEvent):void {
 if(currentModule) { // when I switch to another module
  removeChild(currentModule);
 currentModule = null; // clean it up
 }

 currentModule = new Sprite();
 addChild(currentModule);
 currentModule.addChild(children); //some children are added to
 currentModule
  currentModule.x = (stage.stageWidth * 0.5) - (currentModule.width *0.5) //
 aligns horizontally
 currentModule.y = (stage.stageHeight * 0.5) - (currentModule.height *0.5)
 //
 aligns horizontally
 }

 Now assume I add to the currentModule, a masked list. What I mean is a
 container that contains 100 list items one below the other, and a mask that
 shows just 5 items and the mask's height is 100.
 stage alignment doesn't work properly because the currentModule height is
 not just 100 px (as the mask's height) but it is actually the real height
 that the 100 list item are occupying and so, alignment fails.

 I could use myMask.height, but I need to align the whole currentModule as I
 use it as a wrapper to wrap some components under the same hood.
 What should I do? I tried tracing the mc's height after using scrollRect,
 as
 people said that it would return only the visible part's height but it
 didn't happen. I traced and the same number is there as if nothing were
 masked.
 Any Ideas?

 Thanks in advance
 ___
 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] ScrollRect and masking

2010-07-08 Thread Omar Fouad
Thanks for the reply. I'm already doing that, as the list loads its data
upon added to stage

On Thu, Jul 8, 2010 at 8:25 PM, Ktu ktu_fl...@cataclysmicrewind.com wrote:

 you could try positioning it before you add the 'list' to the displayList
 of
 the container.

 Ktu;

 On Thu, Jul 8, 2010 at 12:49 PM, Omar Fouad omarfouad@gmail.com
 wrote:

  Hello,
 
  I'm working on some project where I have a big container Sprite and based
  on
  what I need, I add some ui inside of it. Once I add this ui, and I make
  sure
  that everything is there on its place, I align this container sprite to
 fir
  in the center of my stage:
 
  private var currentModule:Sprite; // the container
 
  private function updateScreen(e:MouseEvent):void {
  if(currentModule) { // when I switch to another module
   removeChild(currentModule);
  currentModule = null; // clean it up
  }
 
  currentModule = new Sprite();
  addChild(currentModule);
  currentModule.addChild(children); //some children are added to
  currentModule
   currentModule.x = (stage.stageWidth * 0.5) - (currentModule.width *0.5)
 //
  aligns horizontally
  currentModule.y = (stage.stageHeight * 0.5) - (currentModule.height *0.5)
  //
  aligns horizontally
  }
 
  Now assume I add to the currentModule, a masked list. What I mean is a
  container that contains 100 list items one below the other, and a mask
 that
  shows just 5 items and the mask's height is 100.
  stage alignment doesn't work properly because the currentModule height is
  not just 100 px (as the mask's height) but it is actually the real height
  that the 100 list item are occupying and so, alignment fails.
 
  I could use myMask.height, but I need to align the whole currentModule as
 I
  use it as a wrapper to wrap some components under the same hood.
  What should I do? I tried tracing the mc's height after using scrollRect,
  as
  people said that it would return only the visible part's height but it
  didn't happen. I traced and the same number is there as if nothing were
  masked.
  Any Ideas?
 
  Thanks in advance
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

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


[Flashcoders] scrollRect....bad idea?

2006-08-11 Thread Chris Hill
Last night I learned about how cool scrollRect is. It made things a lot 
simpler, and faster, for basic rectangular masking. I was pretty stoked. 
So stoked that I decided to replace my mask within my BaseComponent 
class with a scrollRect. This worked ok for a bit, until I used a class 
that drew directly into BaseComponent, and got flash to consistently 
blow up in my face:


http://newmedia.cdws.ucf.edu/b2evolution/index.php?blog=6title=scrollrect_mystery_crashmore=1c=1tb=1pb=1

Thankfully this smart guy has already dealt with it. I went and 
retrofitted my classes to not draw into the root of BaseComponent, and 
things no longer crashfor now.


So my question is: Do you use scrollRect? Does it work for you? Do you 
have to constantly be careful of this problem, or do you just not use 
scrollRect and live with the performance hit?


Thanks,
Chris Hill
Director of Flash Interrogation
___
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] scrollRect

2006-02-24 Thread JesterXL
Actually, I don't know. I'm sure there are tons of raster methods since I've 
seen Andre Michelle use them, and my PNG's alpha channels are intact.

- Original Message - 
From: Dimitrios Bendilas [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Thursday, February 23, 2006 4:28 AM
Subject: Re: [FlashCoders] scrollRect


Hello Jester,

I apologize for taking S long to reply.

Thank you very much for the information you provided!

When I was asking you how you handle alpha I meant alpha values.
Like when having a few movieclips on top of another, with _alpha = 40 or any
value100.
Can you do that with BitmapData? (sorry if this is a very basic question, I
didn't have the chance to work with bitmaps a lot yet).

I think I'll see how performance goes and maybe I'll bother you and the list
again if I need to start digging more into your approach.

Thanks a lot.

Regards,
Dimitrios

- Original Message - 
From: JesterXL [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Thursday, February 16, 2006 5:11 PM
Subject: Re: [FlashCoders] scrollRect


 BitmapSprites extend Bitmap.  Bitmap is an internal class, and extends
 DisplayObject.  DisplayObjects' have a drawing index, just like MovieClips
 do.  So, instead of swapDepths, you'd use setChildIndex.

 Now, for individual bitmaps that you are drawing, addToBitmapSprite, they
 are added to the internal array, and drawn in that order.  It would be
 probably 10 minutes to add that method and call redraw to allow bitmaps to
 change depth.

 ...or you could do it; I can give you Suversion access to the source if
 you
 wish.

 Alpha is handled by your bitmap.  Bitmaps support alpha channels, so
 whatever bitmap you added should have the alpha.  In my case, the moving
 sprites example uses a circular PNG, and since PNG's have alpha channels,
 Flash draws the circle correctly on top of other circles.

 MovieClip's have gotten more powerful in Flash Player 8.5, yes, mainly
 because of the DisplayList which seperates a MovieClip from existing from
 actually being rendered/drawn each frame.  It is not, however,
 re-inventing
 the wheel.  We have not been able to blit in the Flash Player until
 version
 8; instead, we've had to duplicate a tile 100 times vs. drawing onto 1
 bitmap.

 Great example of why blitting is so powerful and scaleable:
 http://www.gskinner.com/blog/archives/2005/08/flash_8_thought.html

 Significantly less process, less RAM, and scales to infinite bitmaps.

 I have no benchmarks nor numbers other than creating 100 MovieClips in
 Flash
 8 used 99%CPU, and 60 megs of RAM, and the framerate sucked.  Changing
 those
 100 MovieClips to be 1 bitmap, and scrolled via a copyPixels from a
 double-buffering used 6% CPU and full framerate.  That's what made me
 write
 Diesel.

 When you start adding BitmapSprites, you are adding overhead however
 because
 they themselves are DisplayObjects, like MovieClips, only they are drawn
 into 1 bitmap vs. 30 of them drawn in 30 places in the DisplayList.

 The hybrid approach is to use 1 Bitmap, load all of your tiles and draw to
 just 1.  You're actual monsters and characters that move, make Sprites (or
 MovieClips), and remove them from the DisplayList if they are not
 on-screen.
 Use scrollRect for the area you are scrolling, and use double-buffering
 (copyPixels from a rectangle from an off-screen bitmap).

 This doesn't scale well because Sprites have more overhead, and moving
 them
 is sometimes more expensive then copyPixels, but it works well enough in
 the
 alpha, so I'm sure beta, and release it'll still be smokin'.


 - Original Message - 
 From: Dimitrios Bendilas [EMAIL PROTECTED]
 To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
 Sent: Thursday, February 16, 2006 6:36 AM
 Subject: Re: [FlashCoders] scrollRect


 Hi Jester,

 Thanks for the url. It seems very interesting.
 There is one thing that bothers me, aside the fact that
 I'would have to re-write a lot of stuff from scratch, if I
 used a model like this.

 How do you know in what depth to draw everything?
 How do you handle _alphas?

 The movieclip model provides a very easy way to stack
 images one above another with no problems. It just seems
 a lot of work, it's like re-inveting the wheel.

 How much can performance benefit from an approach
 like this? Any benchmarks, numbers?

 Is there a hybrid approach maybe? One that requires
 less code but increases performance?

 Thanks!


 Dimitrios

 - Original Message - 
 From: JesterXL [EMAIL PROTECTED]
 To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
 Sent: Wednesday, February 15, 2006 3:53 AM
 Subject: Re: [FlashCoders] scrollRect


I oringally wrote this in Flash 8, and ported to Flash 8.5.  There is no
 reason it couldn't go back.

 http://www.jessewarden.com/archives/2006/01/diesel_battlefi.html

 - Original Message - 
 From: Dimitrios Bendilas [EMAIL PROTECTED

Re: [FlashCoders] scrollRect

2006-02-23 Thread Dimitrios Bendilas

Hello Jester,

I apologize for taking S long to reply.

Thank you very much for the information you provided!

When I was asking you how you handle alpha I meant alpha values.
Like when having a few movieclips on top of another, with _alpha = 40 or any 
value100.

Can you do that with BitmapData? (sorry if this is a very basic question, I
didn't have the chance to work with bitmaps a lot yet).

I think I'll see how performance goes and maybe I'll bother you and the list
again if I need to start digging more into your approach.

Thanks a lot.

Regards,
Dimitrios

- Original Message - 
From: JesterXL [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Thursday, February 16, 2006 5:11 PM
Subject: Re: [FlashCoders] scrollRect



BitmapSprites extend Bitmap.  Bitmap is an internal class, and extends
DisplayObject.  DisplayObjects' have a drawing index, just like MovieClips
do.  So, instead of swapDepths, you'd use setChildIndex.

Now, for individual bitmaps that you are drawing, addToBitmapSprite, they
are added to the internal array, and drawn in that order.  It would be
probably 10 minutes to add that method and call redraw to allow bitmaps to
change depth.

...or you could do it; I can give you Suversion access to the source if 
you

wish.

Alpha is handled by your bitmap.  Bitmaps support alpha channels, so
whatever bitmap you added should have the alpha.  In my case, the moving
sprites example uses a circular PNG, and since PNG's have alpha channels,
Flash draws the circle correctly on top of other circles.

MovieClip's have gotten more powerful in Flash Player 8.5, yes, mainly
because of the DisplayList which seperates a MovieClip from existing from
actually being rendered/drawn each frame.  It is not, however, 
re-inventing
the wheel.  We have not been able to blit in the Flash Player until 
version

8; instead, we've had to duplicate a tile 100 times vs. drawing onto 1
bitmap.

Great example of why blitting is so powerful and scaleable:
http://www.gskinner.com/blog/archives/2005/08/flash_8_thought.html

Significantly less process, less RAM, and scales to infinite bitmaps.

I have no benchmarks nor numbers other than creating 100 MovieClips in 
Flash
8 used 99%CPU, and 60 megs of RAM, and the framerate sucked.  Changing 
those

100 MovieClips to be 1 bitmap, and scrolled via a copyPixels from a
double-buffering used 6% CPU and full framerate.  That's what made me 
write

Diesel.

When you start adding BitmapSprites, you are adding overhead however 
because

they themselves are DisplayObjects, like MovieClips, only they are drawn
into 1 bitmap vs. 30 of them drawn in 30 places in the DisplayList.

The hybrid approach is to use 1 Bitmap, load all of your tiles and draw to
just 1.  You're actual monsters and characters that move, make Sprites (or
MovieClips), and remove them from the DisplayList if they are not 
on-screen.

Use scrollRect for the area you are scrolling, and use double-buffering
(copyPixels from a rectangle from an off-screen bitmap).

This doesn't scale well because Sprites have more overhead, and moving 
them
is sometimes more expensive then copyPixels, but it works well enough in 
the

alpha, so I'm sure beta, and release it'll still be smokin'.


- Original Message - 
From: Dimitrios Bendilas [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Thursday, February 16, 2006 6:36 AM
Subject: Re: [FlashCoders] scrollRect


Hi Jester,

Thanks for the url. It seems very interesting.
There is one thing that bothers me, aside the fact that
I'would have to re-write a lot of stuff from scratch, if I
used a model like this.

How do you know in what depth to draw everything?
How do you handle _alphas?

The movieclip model provides a very easy way to stack
images one above another with no problems. It just seems
a lot of work, it's like re-inveting the wheel.

How much can performance benefit from an approach
like this? Any benchmarks, numbers?

Is there a hybrid approach maybe? One that requires
less code but increases performance?

Thanks!


Dimitrios

- Original Message - 
From: JesterXL [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Wednesday, February 15, 2006 3:53 AM
Subject: Re: [FlashCoders] scrollRect



I oringally wrote this in Flash 8, and ported to Flash 8.5.  There is no
reason it couldn't go back.

http://www.jessewarden.com/archives/2006/01/diesel_battlefi.html

- Original Message - 
From: Dimitrios Bendilas [EMAIL PROTECTED]

To: flashcoders@chattyfig.figleaf.com
Sent: Tuesday, February 14, 2006 4:55 PM
Subject: [FlashCoders] scrollRect


Hi all,

I'm trying to make a very basic prototype to test parallax movement with
Flash 8.

Is movieclip.scrollRect what I should be using? I tried this:

var bg:MovieClip = _root.attachMovie(bg, bg, 2);
var y:Number = 0;
_root.onEnterFrame = function():Void {
bg.scrollRect = {x:0, y:y--, width:635

Re: [FlashCoders] scrollRect

2006-02-16 Thread Dimitrios Bendilas

Hi Jester,

Thanks for the url. It seems very interesting.
There is one thing that bothers me, aside the fact that
I'would have to re-write a lot of stuff from scratch, if I
used a model like this.

How do you know in what depth to draw everything?
How do you handle _alphas?

The movieclip model provides a very easy way to stack
images one above another with no problems. It just seems
a lot of work, it's like re-inveting the wheel.

How much can performance benefit from an approach
like this? Any benchmarks, numbers?

Is there a hybrid approach maybe? One that requires
less code but increases performance?

Thanks!


Dimitrios

- Original Message - 
From: JesterXL [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Wednesday, February 15, 2006 3:53 AM
Subject: Re: [FlashCoders] scrollRect



I oringally wrote this in Flash 8, and ported to Flash 8.5.  There is no
reason it couldn't go back.

http://www.jessewarden.com/archives/2006/01/diesel_battlefi.html

- Original Message - 
From: Dimitrios Bendilas [EMAIL PROTECTED]

To: flashcoders@chattyfig.figleaf.com
Sent: Tuesday, February 14, 2006 4:55 PM
Subject: [FlashCoders] scrollRect


Hi all,

I'm trying to make a very basic prototype to test parallax movement with
Flash 8.

Is movieclip.scrollRect what I should be using? I tried this:

var bg:MovieClip = _root.attachMovie(bg, bg, 2);
var y:Number = 0;
_root.onEnterFrame = function():Void {
bg.scrollRect = {x:0, y:y--, width:635, height:540};
}

The movieclip bg contains only a jpg 635x540.
The movement is pretty jumpy. Should I be using BitmapData instead?

I'm a bit lost! I've been searching for code samples online for the past 2
hours and
I haven't found anything useful.

Does anyone have a useful link for parallax or tile-based games using 
Flash

8 features?
Performance is the key issue here, since this is going for a very big and
complex game
and I want to optimize it as much as possible.

Thanks a lot!

Dimitrios
___
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] scrollRect

2006-02-16 Thread JesterXL
BitmapSprites extend Bitmap.  Bitmap is an internal class, and extends 
DisplayObject.  DisplayObjects' have a drawing index, just like MovieClips 
do.  So, instead of swapDepths, you'd use setChildIndex.

Now, for individual bitmaps that you are drawing, addToBitmapSprite, they 
are added to the internal array, and drawn in that order.  It would be 
probably 10 minutes to add that method and call redraw to allow bitmaps to 
change depth.

...or you could do it; I can give you Suversion access to the source if you 
wish.

Alpha is handled by your bitmap.  Bitmaps support alpha channels, so 
whatever bitmap you added should have the alpha.  In my case, the moving 
sprites example uses a circular PNG, and since PNG's have alpha channels, 
Flash draws the circle correctly on top of other circles.

MovieClip's have gotten more powerful in Flash Player 8.5, yes, mainly 
because of the DisplayList which seperates a MovieClip from existing from 
actually being rendered/drawn each frame.  It is not, however, re-inventing 
the wheel.  We have not been able to blit in the Flash Player until version 
8; instead, we've had to duplicate a tile 100 times vs. drawing onto 1 
bitmap.

Great example of why blitting is so powerful and scaleable:
http://www.gskinner.com/blog/archives/2005/08/flash_8_thought.html

Significantly less process, less RAM, and scales to infinite bitmaps.

I have no benchmarks nor numbers other than creating 100 MovieClips in Flash 
8 used 99%CPU, and 60 megs of RAM, and the framerate sucked.  Changing those 
100 MovieClips to be 1 bitmap, and scrolled via a copyPixels from a 
double-buffering used 6% CPU and full framerate.  That's what made me write 
Diesel.

When you start adding BitmapSprites, you are adding overhead however because 
they themselves are DisplayObjects, like MovieClips, only they are drawn 
into 1 bitmap vs. 30 of them drawn in 30 places in the DisplayList.

The hybrid approach is to use 1 Bitmap, load all of your tiles and draw to 
just 1.  You're actual monsters and characters that move, make Sprites (or 
MovieClips), and remove them from the DisplayList if they are not on-screen. 
Use scrollRect for the area you are scrolling, and use double-buffering 
(copyPixels from a rectangle from an off-screen bitmap).

This doesn't scale well because Sprites have more overhead, and moving them 
is sometimes more expensive then copyPixels, but it works well enough in the 
alpha, so I'm sure beta, and release it'll still be smokin'.


- Original Message - 
From: Dimitrios Bendilas [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Thursday, February 16, 2006 6:36 AM
Subject: Re: [FlashCoders] scrollRect


Hi Jester,

Thanks for the url. It seems very interesting.
There is one thing that bothers me, aside the fact that
I'would have to re-write a lot of stuff from scratch, if I
used a model like this.

How do you know in what depth to draw everything?
How do you handle _alphas?

The movieclip model provides a very easy way to stack
images one above another with no problems. It just seems
a lot of work, it's like re-inveting the wheel.

How much can performance benefit from an approach
like this? Any benchmarks, numbers?

Is there a hybrid approach maybe? One that requires
less code but increases performance?

Thanks!


Dimitrios

- Original Message - 
From: JesterXL [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Wednesday, February 15, 2006 3:53 AM
Subject: Re: [FlashCoders] scrollRect


I oringally wrote this in Flash 8, and ported to Flash 8.5.  There is no
 reason it couldn't go back.

 http://www.jessewarden.com/archives/2006/01/diesel_battlefi.html

 - Original Message - 
 From: Dimitrios Bendilas [EMAIL PROTECTED]
 To: flashcoders@chattyfig.figleaf.com
 Sent: Tuesday, February 14, 2006 4:55 PM
 Subject: [FlashCoders] scrollRect


 Hi all,

 I'm trying to make a very basic prototype to test parallax movement with
 Flash 8.

 Is movieclip.scrollRect what I should be using? I tried this:

 var bg:MovieClip = _root.attachMovie(bg, bg, 2);
 var y:Number = 0;
 _root.onEnterFrame = function():Void {
 bg.scrollRect = {x:0, y:y--, width:635, height:540};
 }

 The movieclip bg contains only a jpg 635x540.
 The movement is pretty jumpy. Should I be using BitmapData instead?

 I'm a bit lost! I've been searching for code samples online for the past 2
 hours and
 I haven't found anything useful.

 Does anyone have a useful link for parallax or tile-based games using
 Flash
 8 features?
 Performance is the key issue here, since this is going for a very big and
 complex game
 and I want to optimize it as much as possible.

 Thanks a lot!

 Dimitrios
 ___
 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

[FlashCoders] scrollRect

2006-02-14 Thread Dimitrios Bendilas
Hi all,

I'm trying to make a very basic prototype to test parallax movement with Flash 
8.

Is movieclip.scrollRect what I should be using? I tried this:

var bg:MovieClip = _root.attachMovie(bg, bg, 2);
var y:Number = 0;
_root.onEnterFrame = function():Void {
 bg.scrollRect = {x:0, y:y--, width:635, height:540};
}

The movieclip bg contains only a jpg 635x540.
The movement is pretty jumpy. Should I be using BitmapData instead?

I'm a bit lost! I've been searching for code samples online for the past 2 
hours and
I haven't found anything useful.

Does anyone have a useful link for parallax or tile-based games using Flash 8 
features?
Performance is the key issue here, since this is going for a very big and 
complex game
and I want to optimize it as much as possible.

Thanks a lot!

Dimitrios
___
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] scrollRect

2006-02-14 Thread Thomas Wester
You want to use bitmap caching in combination with scrollRect.
Use movieclip.cacheAsBitmap = true 

Also any bitmaps you use should be smoothed. So make sure your jpg is
set to allow smoothing in the library. If you are dynamically loading
jpg's read this. If not read it anyway :)
http://www.kaourantin.net/2005/12/dynamically-loading-bitmaps-with.html

Good Luck.
-Thomas

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Dimitrios Bendilas
Sent: Tuesday, February 14, 2006 1:55 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [FlashCoders] scrollRect

Hi all,

I'm trying to make a very basic prototype to test parallax movement with
Flash 8.

Is movieclip.scrollRect what I should be using? I tried this:

var bg:MovieClip = _root.attachMovie(bg, bg, 2); var y:Number = 0;
_root.onEnterFrame = function():Void {  bg.scrollRect = {x:0, y:y--,
width:635, height:540}; }

The movieclip bg contains only a jpg 635x540.
The movement is pretty jumpy. Should I be using BitmapData instead?

I'm a bit lost! I've been searching for code samples online for the past
2 hours and I haven't found anything useful.

Does anyone have a useful link for parallax or tile-based games using
Flash 8 features?
Performance is the key issue here, since this is going for a very big
and complex game and I want to optimize it as much as possible.

Thanks a lot!

Dimitrios
___
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] scrollRect

2006-02-14 Thread JesterXL
I oringally wrote this in Flash 8, and ported to Flash 8.5.  There is no 
reason it couldn't go back.

http://www.jessewarden.com/archives/2006/01/diesel_battlefi.html

- Original Message - 
From: Dimitrios Bendilas [EMAIL PROTECTED]
To: flashcoders@chattyfig.figleaf.com
Sent: Tuesday, February 14, 2006 4:55 PM
Subject: [FlashCoders] scrollRect


Hi all,

I'm trying to make a very basic prototype to test parallax movement with 
Flash 8.

Is movieclip.scrollRect what I should be using? I tried this:

var bg:MovieClip = _root.attachMovie(bg, bg, 2);
var y:Number = 0;
_root.onEnterFrame = function():Void {
 bg.scrollRect = {x:0, y:y--, width:635, height:540};
}

The movieclip bg contains only a jpg 635x540.
The movement is pretty jumpy. Should I be using BitmapData instead?

I'm a bit lost! I've been searching for code samples online for the past 2 
hours and
I haven't found anything useful.

Does anyone have a useful link for parallax or tile-based games using Flash 
8 features?
Performance is the key issue here, since this is going for a very big and 
complex game
and I want to optimize it as much as possible.

Thanks a lot!

Dimitrios
___
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] scrollRect

2006-02-14 Thread Sascha Balkau

JesterXL,

I'd be interested in see this engine running but the demos on your site seem 
not to work anymore with the latest Flash 8.5  alpha player.
If I import the project into Flex Builder and try to run it , it tells me 
that some errors exist but it doesn't show me where the errors are.
Would be cool to get a hint on this to compile it with the latest Flex beta 
to make it run.


Thanks,
Sascha





I oringally wrote this in Flash 8, and ported to Flash 8.5.  There is no
reason it couldn't go back.

http://www.jessewarden.com/archives/2006/01/diesel_battlefi.html

- Original Message - 
From: Dimitrios Bendilas [EMAIL PROTECTED]

To: flashcoders@chattyfig.figleaf.com
Sent: Tuesday, February 14, 2006 4:55 PM
Subject: [FlashCoders] scrollRect


Hi all,

I'm trying to make a very basic prototype to test parallax movement with
Flash 8.

Is movieclip.scrollRect what I should be using? I tried this:

var bg:MovieClip = _root.attachMovie(bg, bg, 2);
var y:Number = 0;
_root.onEnterFrame = function():Void {
bg.scrollRect = {x:0, y:y--, width:635, height:540};
}

The movieclip bg contains only a jpg 635x540.
The movement is pretty jumpy. Should I be using BitmapData instead?

I'm a bit lost! I've been searching for code samples online for the past 2
hours and
I haven't found anything useful.

Does anyone have a useful link for parallax or tile-based games using 
Flash

8 features?
Performance is the key issue here, since this is going for a very big and
complex game
and I want to optimize it as much as possible.

Thanks a lot!

Dimitrios
___
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] scrollRect

2006-02-14 Thread JesterXL
Ah, the joy of alpha software... sorry about that.

:: goes to fix ::

Remind me to do this again when Flex 2 is released.  There is a bug with 
flash.display.Loader, and Adobe is already aware of it (Tile Loader will 
load every other image).  Additionally, the html-template is not included 
(Subversion is being a bitch), so when you get the error in Flex Builder 2, 
just right click on the error and Rebuild html-template

Other than that, she actually works a tad faster and uses less RAM with the 
beta.

http://dev.jessewarden.com/flash/diesel/jxl_diesel_battlefield_beta1.zip

http://diesel.avlux.net/svn/
u: public
p: public


- Original Message - 
From: Sascha Balkau [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Tuesday, February 14, 2006 10:26 PM
Subject: Re: [FlashCoders] scrollRect


JesterXL,

I'd be interested in see this engine running but the demos on your site seem
not to work anymore with the latest Flash 8.5  alpha player.
If I import the project into Flex Builder and try to run it , it tells me
that some errors exist but it doesn't show me where the errors are.
Would be cool to get a hint on this to compile it with the latest Flex beta
to make it run.

Thanks,
Sascha




I oringally wrote this in Flash 8, and ported to Flash 8.5.  There is no
 reason it couldn't go back.

 http://www.jessewarden.com/archives/2006/01/diesel_battlefi.html

 - Original Message - 
 From: Dimitrios Bendilas [EMAIL PROTECTED]
 To: flashcoders@chattyfig.figleaf.com
 Sent: Tuesday, February 14, 2006 4:55 PM
 Subject: [FlashCoders] scrollRect


 Hi all,

 I'm trying to make a very basic prototype to test parallax movement with
 Flash 8.

 Is movieclip.scrollRect what I should be using? I tried this:

 var bg:MovieClip = _root.attachMovie(bg, bg, 2);
 var y:Number = 0;
 _root.onEnterFrame = function():Void {
 bg.scrollRect = {x:0, y:y--, width:635, height:540};
 }

 The movieclip bg contains only a jpg 635x540.
 The movement is pretty jumpy. Should I be using BitmapData instead?

 I'm a bit lost! I've been searching for code samples online for the past 2
 hours and
 I haven't found anything useful.

 Does anyone have a useful link for parallax or tile-based games using
 Flash
 8 features?
 Performance is the key issue here, since this is going for a very big and
 complex game
 and I want to optimize it as much as possible.

 Thanks a lot!

 Dimitrios
 ___
 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