Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411610 Posts in 69388 Topics- by 58447 Members - Latest Member: sinsofsven

May 09, 2024, 12:30:14 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Rinku & Increpare (and more?) Learn Flash
Pages: 1 ... 26 27 [28] 29
Print
Author Topic: Rinku & Increpare (and more?) Learn Flash  (Read 76503 times)
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #540 on: May 21, 2009, 02:50:41 PM »

Yes, AS2 was a worse language, but it's performance was dreadful for being based on the same VM as the original actionscript, which was little more than goto and if statements (like GameMaker is currently), and grown "organically".

It was possible to write substantial programs in AS2, but actual calculation was unheard of. I remember trying to write pacman with pathfinding ghosts. After discovering it was intolerably slow, I decided to precache all calculations (yes, at high memory expense), only loading all that in for each level was also too slow.

Some of those early games produced by peoples were really miracles of engineering. I decompiled the original version of Pico's School (THE newgrounds original). It was written before variables existed in the language - all state was stored in the stage timeline and the timeline of inventory icons - genius. 
Or that Flash Sonic game, which had a rolling movie clip of different horizontal slices of the game world so you could scroll through at great speed without loading and unloading tons of objects using code, or having too much loaded at once.
(NB: the above is based on memory, may not be completely accurate.)
Logged
Glaiel-Gamer
Guest
« Reply #541 on: May 27, 2009, 08:02:49 PM »

True that. There were a lot of little tips and tricks to make stuff run faster.

In flash 8, speed increased a little. But there were still tricks to maximize speed, like, reading and writing to a bitmapdata object was actually faster than using arrays. Course now there's bytearrays and vectors which are better than that.

I remember my first game in AS3, I was so excited to be able to run a for loop in the background every frame to determine when to display achievement icons, and being able to actually use sin and sqrt without worrying about speed.
Logged
Μarkham
Level 10
*****



View Profile WWW
« Reply #542 on: June 09, 2009, 03:17:16 PM »

Any idea on why lines appear between tiles when I set cacheAsBitmap = true?  Nothings being scaled up or down, and they're all exact whole numbers in height and width.
Logged

Glaiel-Gamer
Guest
« Reply #543 on: June 09, 2009, 03:22:41 PM »

and they're all exact whole numbers in height and width.

you mean, as exact as floating point accuracy can get.

give the tiles a small margin of error
Logged
Μarkham
Level 10
*****



View Profile WWW
« Reply #544 on: June 09, 2009, 05:11:11 PM »

I fixed it by putting int() around all x and y coordinate calculations involving division.

[edit]

I looked up the command in Adobe's "reference," but it doesn't say whether a movie clip (set to draw as bitmap) will include contained movie clips (not set to draw as bitmap) as part of the function or not.  More specifically, while the above works, I've found that just setting the container for a background section of tiles to draw as a bitmap instead of each tile works (no faint lines between tiles) even when the window is resized, but I don't know if it's just that only the container is drawn and not the things contained in it.
« Last Edit: June 09, 2009, 05:32:43 PM by Markham » Logged

Glaiel-Gamer
Guest
« Reply #545 on: June 09, 2009, 08:48:11 PM »

I fixed it by putting int() around all x and y coordinate calculations involving division.

[edit]

I looked up the command in Adobe's "reference," but it doesn't say whether a movie clip (set to draw as bitmap) will include contained movie clips (not set to draw as bitmap) as part of the function or not.  More specifically, while the above works, I've found that just setting the container for a background section of tiles to draw as a bitmap instead of each tile works (no faint lines between tiles) even when the window is resized, but I don't know if it's just that only the container is drawn and not the things contained in it.

do you mean "cache as bitmap"?

Cause caching causes flash to simply store the vector rasterization, but flash will recalculate it if the clip is scaled, animated, rotated, or any other transformation besides translation. This includes parent transformations, and changing of quality. Coordinates are floating point though, so shuffling a clip a fractional amount can cause antialiasing artifacts to appear, which might be what your breaks were.
Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #546 on: June 10, 2009, 11:50:26 AM »

Flash does some magic involving bitmaps. If they are non-rotated scaled etc, and on a whole number of pixels, they'll draw 1 screen pixel to one bitmap pixel. Anything else and it'll use a different drawing routine, and you'll never get it to line up properly without overlap. But it determines whole number of pixels in a funny way, so you do need things like int in order to be certain.
Logged
mirosurabu
Guest
« Reply #547 on: July 26, 2009, 04:14:59 AM »

I have some issues with ByteArrayAsset type.

Namely, I'm trying to embed binary objects into my SWF (levels) and then parse data from them. But the problem is that Flex doesn't really recognize mx.core as a package and although it compiles fine when imported and used I get no results.

Here's my code:
Code:
		protected function loadCoins(CoinsData:Class):void
{
if (!CoinsData) return;

_coins = new FlxArray();
var data:ByteArrayAsset = ByteArrayAsset(new CoinsData());

while (data.bytesAvailable > 0)
{
var x:uint = data.readInt();
var y:uint = data.readInt();

_coins.add(new FlxSprite(ImgCoin, x, y));
}

for (var i:uint = 0; i < _coins.length; i++)
{
add(_coins[i]);
}
}
Logged
mirosurabu
Guest
« Reply #548 on: July 26, 2009, 07:35:35 AM »

Solved. The default byte order wasn't appropriate. Changing the byte order to little endian solved the problem.
Logged
mirosurabu
Guest
« Reply #549 on: August 26, 2009, 02:13:06 AM »

Quick question:

Is it possible to turn off text anti-aliasing (smoothing) in Flash? Because, the text is blurry and does not fit with the rest of the scene.

Thanks
Logged
bateleur
Level 10
*****



View Profile
« Reply #550 on: August 26, 2009, 05:33:39 AM »

You might be able to achieve this by playing around with TextRenderer. Unfortunately for you there doesn't seem to be a TextDisplayMode.NONE option, but using setAdvancedAntiAliasingTable() with the inside and outside cutoffs on top of each other might do the trick.

(Disclaimer: haven't actually tried this!)
Logged

John Nesky
Level 10
*****


aka shaktool


View Profile WWW
« Reply #551 on: August 26, 2009, 09:48:24 AM »

To disable text antialiasing (along with the rest of antialiasing) set the quality to low. You can do this programmatically by accessing the Stage object.
Logged
hatu
Level 2
**



View Profile
« Reply #552 on: September 11, 2009, 03:40:37 AM »

Well atleast in the Flash IDE (CSx) you can select the Anti-alias of a Textfield to be Bitmap text [no anti-alias]. Not sure how that would be done with AS but if you have Flash then you can do them there atleast.
Logged
Aaron P
Level 0
***

!


View Profile
« Reply #553 on: September 11, 2009, 02:23:29 PM »

Ok, bare with me, I am a super beginner to AS3.

Take this arbitrary code...

Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, jump);

function jump(event:KeyboardEvent):void
{
userObject.y -= 50;
}

Why when running this code do a shitton of keys not respond? Q,E,R,T,Y,I,O,P,A,S,F,H,J,K,L,Z,C,V,B,N,M...none of these letter keys work. Numbers seem to work, arrow keys work, even CAPS lock worked, but none of the stated letter keys respond. I tried two different keyboards with identical results. ( Im using CS3 btw )

Help? I know im going to feel extra retarded when the answer somes out.  Embarrassed
Logged
Aaron P
Level 0
***

!


View Profile
« Reply #554 on: September 11, 2009, 02:43:16 PM »


Help? I know im going to feel extra retarded when the answer somes out.  Embarrassed

Nevermind, i figured it out and I do feel semi-retarded. In the preview swf, I needed to "Disable Keyboard Shortcuts", apparently they were stealing my keypresses.  Cry
Logged
G.I.L.
Guest
« Reply #555 on: September 30, 2009, 05:16:01 PM »

Just one question. Is 29/30 fps acceptable for a flash game?
Logged
John Nesky
Level 10
*****


aka shaktool


View Profile WWW
« Reply #556 on: September 30, 2009, 05:43:37 PM »

Yes. It's hard to beat, especially in a browser. Lots of browsers artificially limit the framerate.
Logged
dustin
Level 6
*


View Profile
« Reply #557 on: October 03, 2009, 03:34:01 PM »

Any one know how to read or write to a file in as3 if it's running on the persons computer (ie. not a browser).  So far I have found that you can't actually do it from inside as3 so I wrote a perl script to do it for me but now I don't know how to call the perl script from in flash!
Logged
John Nesky
Level 10
*****


aka shaktool


View Profile WWW
« Reply #558 on: October 03, 2009, 05:10:21 PM »

Use AIR:
http://www.adobe.com/products/air/
http://livedocs.adobe.com/flex/3/langref/flash/filesystem/package-detail.html

AIR requires familiarity with MXML though.
Logged
agj
Level 10
*****



View Profile WWW
« Reply #559 on: October 03, 2009, 05:10:54 PM »

It's a security sandbox issue. In FlashDevelop, you fix this by setting 'use network services', in compiler options, to false.
Logged

Pages: 1 ... 26 27 [28] 29
Print
Jump to:  

Theme orange-lt created by panic