Hi, just curious for movieclips does using _visible = false when not in use
prevent lag or is there a better way?
Printable View
Hi, just curious for movieclips does using _visible = false when not in use
prevent lag or is there a better way?
I think is better attach the movieclips dynamically, then, when not using 'emThat must prevent lag. I think setting it visible, doesn't avoid the movieclip to "exists" on the canvas.Actionscript Code:myMovieCLip.removeMovieClip();
Yeah, but they are going to be reused, my mmo has about 400 isometric tiles right now When the vcam is over them they will be used and when its not they have to hide some how. I have not had lag yet amazingly but I want to be cautious
Hi,
mc.enabled = false;
mc.enabled = true;
Hello! Fruitbeard, i think disabling it doesn't avoid the lag. Disabling a button or a movieclip only "removes" the interaction within, on press, on rollover, etc. but the movieclip will still be there on the canvas, consuming memory. But anyway Basses, try disabling the movieclip and tell us.
I'll try that later by the way do any of you know how I can refresh code to recheck every second:
this.player_depth = Math.floor(this._y*500+this._x);
this.swapDepths(this.player_depth);
you can do this
actionscript Code:function sleep(){
this.player_depth = Math.floor(this._y*500+this._x);
this.swapDepths(this.player_depth);
}
var sleeping = setInterval(sleep, 1000);
1000 milliseconds= 1 second, each second that code will happen
Doesn't seem to be triggering
Actually yeah it works but not helping :/
Try this then
actionscript Code:this.onEnterFrame=function(){
this.player_depth = Math.floor(this._y*500+this._x);
this.swapDepths(this.player_depth);
};
Yeah the code always worked but I was just using this to troubleshoot I found out that whenever I use depth swapping code for my players and someone else logs in the first player duplicates its movie clip and it looks all wierd I goto figure something :/
Its always supposed to have a duplicate, but that duplicate stays in alpha = 0 but for some reason the swap depth ruins it and it shows up.
edit: ok I think I know whats doing this its a vcam issue still goto fix it though lol I hate how everytime i have a problem it turns to a big problem
lol don't worry. That always happens. I ended formating my computer because I couldn't hear any sounds in flash with actionscript, but yes embbeded on the timeline. And it resulted in thisActionscript Code:mySound1.attachSound("mySound1");
mySound1.attachSound("mySound1");
mySound1= new Sound();
mySound2=new Sound();
The new sound goes first, and below it the attachSound. Lol.
And by the way, i don't know anything of vcam so i cant help you sorry
Its ok, and yeah I remember you saying you couldn't hear sound somewhere on the forums glad you have it solved.
Hi,
please don't use vCam, I've just finished developing a game which I started last year on (continued on it this year), and I had implemented vCam as the main camera in my game, and it was a huge mistake, and I didn't realize it till now (because I wasn't as experiencing in AS last year, as I am now). It has caused me so much trouble and headaches that I was on the verge of giving up, but hopefully I somehow managed to find ways around my problems and finally submitted my game. vCam may be good for animations, but for games, it should be avoided :)
And what you suggest, Nig, we should use instead of vCam, for games? I was about to start reading about vCam...
vCam is not a feature of Flash, it's just a Virtual Camera someone has developed for Flash, it basically just resizes and repositions the current Movieclip to show what's only inside the vCam movieclip (yeah, it's just a movieclip with some code in it). As already suggested, Basses6, I think you should just stick with arrows as navigation to lead to different rooms, that'd be the best option.
I think that _visible only disables button clicks and stuff like that (as already mentioned by angelhdz). Instead, in your Tile movieclip, make another Frame, and keep it empty. When you don't want to use the Tile, simply switch to Frame 2, where it's empty, because lag occurs when there's too much on the screen at once. I think this should solve it, but I still don't recommend having 1000 tiles in a Frame and using vCam to walk through it, that is highly unadviced, that is if you're planning on making a whole world :P
Also, instead of using vCam, you can simply move the background and other elements instead, creating the illuson of the character walking when in fact everything else is moving. Just search for vCams and platformers, and you'll probably stumble upon a few topics where it's stated that vCam will mess up the collision in platformers.
EDIT: 1600th Post :D
Yeah but illusion of walking is only good to an extent there will be others online and they will see you walking in literally 1 spot most likely. my vcam has created problems but I fixed them all, so I see no reason to abandon it. nice 1600th post :P
Well, whatever suits you best then :P
Im sticking to the rooms method when a nigs right he's right. :s
No, why D:???
Seriously, stop thinking like I'm a pro and everything I say is correct. You gotta learn to oppose others, even though they might be the one who've taught you before, lol. I have no experience with flash online multiplayer coding, so I don't know what's best. Just use whatever you want, 'cause I might not always be correct ;)
No, its a mess, I was thinking about just having medium sized maps that only require slight canvas movement, do you know how I can tween the canvas, ill also tween the tool bar with it.
I think if this were possible itd be way more efficient and i'll still have button navigation
but I can have slightly larger rooms, you get me?
Nope, I have no idea as I don't know how SmartFoxServer functions :(
nooo, it has nothing to do with smart fox I even abandoned it though im using my own socket server I made using a tutorial, I just want to know lets say my character hit tests a certain object than the screen would move up acouple of pixels as in screen I mean the canvas or what ever you call it.
I dunno what you mean by the canvas, but just change the _y of the map :?
Forget it, If I change the _y and _x of the map the server will still see the character on the same x y position so itl look weird, I dont think you'd understand but w.e i'll figure something, thanks
Why not offset the character by how many pixels you've moved the map??
I already thought of that, the game would look for the person moving, but for another player on the game it will look odd because the maps moving for them not for you.
Well, I'm out of ideas...
Is the only way to move the canvas by using vcam?
vCam only uses _xscale, _yscale, _x and _y to reposition and rescale the current movieclip it's in, so you should be able to manually use those properties to do it..
Canvas = Stage
oh, thanks angelhdz, I was a bit confused what he meant by Canvas XDXD
In that case, use _root, which is the "canvas", the stage itself:
_root._xscale
_root._yscale
_root._x
_root._y