Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411587 Posts in 69386 Topics- by 58443 Members - Latest Member: Mansreign

May 06, 2024, 10:00:48 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Learning to program in Flash (title changed for obvius (or not) reason)
Pages: 1 [2]
Print
Author Topic: Learning to program in Flash (title changed for obvius (or not) reason)  (Read 3743 times)
bateleur
Level 10
*****



View Profile
« Reply #20 on: November 08, 2009, 11:36:52 PM »

You do that in one of two ways:

1) The easy case is where your Flash application is the size you want for the view. In this case, simply set the MovieClip as a child of the root DisplayObject and use its x and y properties to position the MovieClip once per frame via the frame event for any of the DisplayObjects involved.

2) The slightly trickier case is where the view you want is smaller than the Flash application. In this case you need to create a separate DisplayObject to use for the root, add the MovieClip as a child as before, but also add a second child to use as a mask, then set the mask property of the view DisplayObject appropriately. (And don't forget to set the visibility of the mask object to false, or it will be rendered, which isn't what you want.)
Logged

Glaiel-Gamer
Guest
« Reply #21 on: November 09, 2009, 12:09:20 AM »

if you mean "camera" then there's no built in camera class or functionality in flash (a weird overlook considering it started off as an animation program, a number of people have made animation tools or libraries for camera's, but it's easy enough to implement that it's not worth it to try and learn a library)

make sure you don't add children to the root or stage and instead add them all in one clip (I usually call it "game").

store your camera values (camx, camy, camrotation, camscalex, camscaley)
then you can make a matrix

var m:Matrix = new Matrix;
m.scale(1/camscalex, 1/camscaley)
m.rotate(-camr);
m.translate(-x, -y);

game.transformMatrix = m;



transformMatrix might not be the right property name, look it up on the livedocs to be sure
also i might have the matrix transformations backwards

livedocs:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/
learn to love that site
Logged
YagerX
Level 2
**



View Profile WWW
« Reply #22 on: November 09, 2009, 12:34:23 AM »

You could cover the excess area with what I assume to be your gui? Although for performance reasons, you might want to check whether certain objects are within view or not and then remove them from the display list.
Logged

davidp
Level 6
*



View Profile WWW
« Reply #23 on: November 09, 2009, 03:17:20 AM »

ok guys, thanks for the suggestions and reply, gonna check the livedocs link and stuff mentioned. appreciate it.
Logged

Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic