To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 04-19-2007, 12:01 AM   #1
Nositi
Junior Member
 
Join Date: Apr 2007
Posts: 4
[Flash 8] Moving the stage possible?

Hi,

Simplified version: Is there a way to move the stage?

Long version:
I'm working on a vertical scrolling game for a class. It's actually pretty much done (and due soon), so I don't have a lot of time left to work on it, but I do still have a few things to fix and tune. Essentially, we have a tall image that serves as our background, with only a small amount visible at a time. I could only think of 2 ways to achieve this:
1. The stage moves when appropriate, and all other non-stationary objects move independently.
2. The stage doesn't move, but instead the background image and everything other than the main character move in the direction opposite to that which the stage would otherwise move.

Now, I think the first option would have been ideal. However, when starting to work on this game, I couldn't find any way to actually move the screen. I googled, I searched on here, and I asked a couple of people who had some (minimal) experience with Flash and Action Script. So I ended up using the second method. It works, but it is a bit sluggish. I couldn't imagine how slow it would be if the levels were twice as long or there were twice as many objects!

So, I wish I'd asked this here much earlier, but is there a way to move the stage? It will probably require me to redo quite a few things and is not a make/break thing, so this will be low on my priority list, but I would really like to know for future reference.



Oh, and a second question. Is there a way that I can preventing the image of a movieclip from actually rendering (not sure if this is the right terminology)? That is, I want the object to always exist and the object's variables to consistently be accessible (including _x and _y), but when it's not visible (off the stage), there's no point in the object's image actually being there. I imagine I could make things more efficient by doing this. This one I haven't really looked into, but I figured I should ask while I'm posting the other question.

Thanks in advance!
Nositi is offline   Reply With Quote
Old 04-19-2007, 02:40 AM   #2
Speed85
Senior Member
 
Speed85's Avatar
 
Join Date: Apr 2007
Posts: 292
I think the easiest way would be to put everything except your main character into an array and then adjust the ._x values that way, I think that should work. The other option that I can think of would be to put everything into a seperate movie clip the size of the entire stage, then adjust that movie clip's _x.

Maybe someone else could come up with a better way to do that part, but for your 2nd question, easy. You want the movie clip to be on the stage but not visible right? Just use moveClip._visible = false.
Speed85 is offline   Reply With Quote
Old 04-19-2007, 03:32 AM   #3
Nositi
Junior Member
 
Join Date: Apr 2007
Posts: 4
Yeah, that's effectively how it works now. Well, I didn't use an array. It's just a for loop on all objects except the main character. Putting it all into one movieclip is an interesting idea though, I wish I'd thought of that.

Ok, thanks. I figured it would be something simple like that, but will that likely speed things for me?
Nositi is offline   Reply With Quote
Old 04-19-2007, 04:32 AM   #4
Speed85
Senior Member
 
Speed85's Avatar
 
Join Date: Apr 2007
Posts: 292
Well if you did that now I'm not sure if it would help later or not since you already have it set up. It all depends on whether you want to add different functions to the game later. Like say a pause or changing difficulty by changing the speed of movement. The only slight problem with this is you'd have to go change your code to suit everything being inside the movie clip.

But anyways, I hope I helped.
Speed85 is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:00 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.