Why can't I fit my AIR app to the screen of the device ??
Hi all,
I've made some apps on device but it's the first time that I can't make the app fit the screen and I really don't understand why.
I've downloaded an exemple of the game Flappy bird and I would like to play with my device.
Can you help me make the app fit the device screen please ?
Here's my main.as
package{
import citrus.core.starling.StarlingCitrusEngine;
import flash.display.Stage;
import flash.events.*;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
[SWF(frameRate="60")]
public class Main extends StarlingCitrusEngine {
public function Main() {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.EXACT_FIT;
override public function initialize():void {
setUpStarling();
//starling is ready, we can load assets
override public function handleStarlingReady():void
state = new FlappyBirdGameState();
Here's my FlappyBirdGameState.as :
public function FlappyBirdGameState()
super();
override public function initialize():void
super.initialize();
ce = CitrusEngine.getInstance();
// load assets, then draw screen
loadAssets();
// fly with the spacebar, alternatively
kb = ce.input.keyboard;
kb.addKeyAction("fly", Keyboard.SPACE);
private function loadAssets():void {
assets = new AssetManager();
assets.verbose = true;
assets.enqueue(Assets);
assets.loadQueue(function(ratio:Number):void
trace("Loading assets, progress:", ratio);
if (ratio == 1.0)
// add game elements
drawScreen();
private function drawScreen():void
var bg:CitrusSprite = new CitrusSprite("bg", {x: 0, y: 0, width: 320, height: 480});
bg.view = new Image(assets.getTexture("bg.png"));
add(bg);
box = new CitrusSprite("box", {x: 40, y: -200, width: 240, height: 200});
box.view = new Image(assets.getTexture("box.png"));
add(box);
textField = new TextField(200, 200, "CLICK TO FLY", "Flappy", 20, Color.NAVY);
textField.x = 60;
textField.y = -200;
addChild(textField);
// box and textField have synced tweens
eaze(box).to(0.4, { y: 150 } );
eaze(textField).to(0.4, { y: 150 } );
ce.stage.addEventListener(MouseEvent.MOUSE_DOWN, start);
function start(e:MouseEvent):void
eaze(box).to(0.2, { y: -200 } );
eaze(textField).to(0.2, { y: -200 } );
newGame();
ce.stage.removeEventListener(MouseEvent.MOUSE_DOWN, start);
public function newGame():void
// get a random Y position for first pipe
randomizePipeY();
pipe1 = new CitrusSprite("pipe", {x: 380, y: pipeY, width: 60, height: 160});
pipe1.view = new Image(assets.getTexture("pipe.png"));
add(pipe1);
pipeBoundsTop1 = new Rectangle(0, 0, 50, 355);
pipeBoundsBottom1 = new Rectangle(0, 0, 50, 364);
// get a random Y position for second pipe
randomizePipeY();
pipe2 = new CitrusSprite("pipe2", {x: 620, y: pipeY, width: 60, height: 860});
pipe2.view = new Image(assets.getTexture("pipe.png"));
add(pipe2);
pipeBoundsTop2 = new Rectangle(0, 0, 50, 355);
pipeBoundsBottom2 = new Rectangle(0, 0, 50, 364);
// the character
thing = new CitrusSprite("thing", {x: 100, y: 200, width: 40, height: 50});
thingImage = new Image(assets.getTexture("thing.png"));
thing.view = thingImage;
add(thing);
thingBounds = new Rectangle(0, 0, 35, 45);
ce.stage.addEventListener(MouseEvent.MOUSE_DOWN, fly);
// move box to top
var container:Sprite = view.getArt(box).parent;
container.swapChildren(view.getArt(box) as DisplayObject, view.getArt(pipe1) as DisplayObject);
container.swapChildren(view.getArt(box) as DisplayObject, view.getArt(pipe2) as DisplayObject);
container.swapChildren(view.getArt(box) as DisplayObject, view.getArt(thing) as DisplayObject);
// score text field
scoreText = new TextField(300, 50, "", "Flappy", 20, Color.NAVY);
scoreText.hAlign = "right";
scoreText.x = -10;
scoreText.y = 0;
addChild(scoreText);
// a few more things
clicked = true;
score = 0;
velocity = -7;
// click to fly
public function fly(e:MouseEvent):void
velocity = -7;
assets.playSound("whoosh");
// get a new Y position for a pipe
private function randomizePipeY():void
pipeY = new Number(Math.floor(Math.random() * -330) + -40);
override public function update(timeDelta:Number):void
super.update(timeDelta);
if (clicked)
if (!gameOver)
// move pipes
pipe1.x -= 2;
pipe2.x -= 2;
// after pipes go off screen, move them
if (pipe1.x <= -60)
//randomize pipe Y
randomizePipeY();
pipe1.x = 380;
pipe1.y = pipeY;
if (pipe2.x <= -60)
// randomize pipe Y
randomizePipeY();
pipe2.x = 380;
pipe2.y = pipeY;
// fly through a pipe, gain a point
if (pipe1.x == thing.x || pipe2.x == thing.x)
score++;
scoreText.text = String(score);
assets.playSound("ding");
// spacebar to fly
if (ce.input.justDid("fly"))
if (!gameOver)
velocity = -7;
assets.playSound("whoosh");
// character falls with gravity
velocity += gravity;
thing.y += velocity;
// prevent flying through the top and bottom of screen
if (thing.y <= 0)
thing.y = 0;
if (thing.y >= 430)
thing.y = 430;
// collision
thingBounds.y = thing.y + 2.5;
thingBounds.x = thing.x + 2.5;
pipeBoundsTop1.x = pipe1.x + 5;
pipeBoundsTop1.y = pipe1.y;
pipeBoundsBottom1.x = pipe1.x + 5;
pipeBoundsBottom1.y = pipe1.y + 495;
pipeBoundsTop2.x = pipe2.x + 5;
pipeBoundsTop2.y = pipe2.y;
pipeBoundsBottom2.x = pipe2.x + 5;
pipeBoundsBottom2.y = pipe2.y + 495;
// lose the game
if (thingBounds.intersects(pipeBoundsTop1) || thingBounds.intersects(pipeBoundsBottom1)
|| thingBounds.intersects(pipeBoundsTop2) || thingBounds.intersects(pipeBoundsBottom2))
die();
// death, show score and click to play again
private function die():void
if (!gameOver)
gameOver = true;
assets.playSound("smack");
ce.stage.removeEventListener(MouseEvent.MOUSE_DOWN, fly);
// prevent clicking briefly to let the player see their score
var t:Timer = new Timer(500, 1);
t.addEventListener(TimerEvent.TIMER_COMPLETE, cont);
t.start();
function cont(e:TimerEvent):void
textField.text = "Score: " + score;
scoreText.text = "";
eaze(box).to(0.4, { y: 150 } );
eaze(textField).to(0.4, { y: 150 } );
ce.stage.addEventListener(MouseEvent.MOUSE_DOWN, startOver);
// reset everything, start the game again
private function startOver(e:MouseEvent):void
eaze(box).to(0.2, { y: -200 } );
eaze(textField).to(0.2, { y: -200 } );
score = 0;
pipe1.x = 380;
pipe2.x = 620;
thing.x = 100;
thing.y = 200;
velocity = 0;
gravity = 0.4;
gameOver = false;
randomizePipeY();
ce.stage.removeEventListener(MouseEvent.MOUSE_DOWN, startOver);
ce.stage.addEventListener(MouseEvent.MOUSE_DOWN, fly);
Thanks,
Yeah, it should. But, weirdly, it's not...
Here's what I see on the device emulator with Adobe Flash Pro :
And here's what I see when I install the apk on my Android device :
Can't understand why it's happening.
The game was in an example package of the citrus engine : https://drive.google.com/file/d/0B5-MjJcEPm3lMU5jSzB0dDBualk/view?usp=sharing
Similar Messages
-
Why can't i fit my full photo as a wallpaper?
Why can't i fit my full photo as a wallpaper? I want to use a photo i had before the ios7 upgrade, but when i try to fit the whole photo as a wallpaper, it always zooms in. I dont want my photo to be zoomed in when i want to change the wallpaper, i want the whole full photo to show up as my wallpaper. Can this be fixed? I never had this problem until i downloaded the new software ios7
I kinda found a way to fit your full photo as a wallpaper. Its a bit of a hassle, but this method can be temporarly used until apple fixes the wallpaper issue. For now what i do is i downloaded an APP called PIC COLLAGE, its free. And i put one photo(or as many as you want) in the center of the collage in the app. I minimized the photo(only) so the whole photo can come out as a wallpaper. Once you put the minimized photo in the middle of the collage, you can save it and use it as a wallpaper. When your about to change the wallpaper, Zoom in into your photo collage you saved so you can fit it on your screen completely. You can even change the background of the collage which can make your wallpaper look even better when its your using it as a landscape mode. Thats the best tactic i can come up with, but it looks great even with the moving motion. You guys try it out. This could be a stress reliever lol
-
Why does a 128gb I-pad Air 2 only show 113gb in the capacity section of settings? Where has my other 15gb gone. Surely not on the OS. (It shows 111gb available which is the apps I have downloaded already)
Along with what Skydiver119 has already told you, my 64GB iPad 3 only had 57GB of available storage out of the box, so if you keep doubling the amount of already used storage on the device as you go from 16 to 32 to 64 and then to 128GB - I assume that the figure that you see is correct. The iOS and preinstalled apps account for the storage that seems to be "missing" to you on your iPad.
The amount that you see in Settings>General>About>Capacity is in fact, the available storage capacity for your iPad. You can't change it. It is whatever it says it is in that setting. -
Why can't i see "Find iPhone" App under cellular data so I can turn it on?
Why can't i see "Find iPhone" App under cellular data so I can turn it on?
We have cell data plan.
I have other phones (4s) and can see "Find Phone" App under Cellular Data and can turn on/off. But the problem phone does not have "Find IPhone" to be able toturn on/off. I made sure app is running when i go to Cellular Data. I guess the question is why do Apps show up under Cellular Data to be able to turn on/off? I thought if the app was made for Cellular Data it automatically showed up under Cellular Data. -
Why can't I see reviews for app updates on iPad 3rd gen since iOS 7 update?
Why can't I see reviews for app updates on iPad 3rd gen since iOS 7 update?
AAfter an hour with Apple chat, I figured out what to do on my own. When the iPhone and iPad go to autolock, press home key and do not open- streaming will be on the screen and I turned it back on. No more stops.
-
Why can't I open iTunes or apps on ipad1? And why do apple not support the latest update for ipad1 when it's less than 2 years old. I am sick of huge corporations ripping off joe public!
And the processor limitations.
iPad: RAM - 256MB, Processor - 1 GHz Apple A4
iPad 2: RAM - 512MB, Processor - 1GHz dual-core Apple A5
iPad 3: RAM 1024MB, Processor - 1GHz dual-core Apple A5X
Similarily, the iPad 2 did not get Siri and some other features in iOS 6.
Cheers, Tom -
Why can't I download any more apps on my iPad mini
Why can't I download any more apps on my ipad mini
Try deleting the waiting app then reset your device. Press and hold the Home and Sleep buttons simultaneously until the Apple logo appears. Let go of the buttons and let the device restart. See if that fixes your problem.
-
Why can't I open iTunes and App Store on my brand new iPad mini.
Why can't I open iTunes and App Store on my brand new iPad mini.
Have you set up an iTunes account?
iTunes Store: Changing Account Information
http://support.apple.com/kb/HT1918
iTunes Store: Associating a device or computer to your Apple ID
http://support.apple.com/kb/ht4627
Apple ID Support - Manage Account
http://www.apple.com/support/appleid/manage/
Cheers, Tom -
Why can't I make an in-app purchase?
I try to make an in-app purchase and I get a message saying could not complete purchase and that I should go to the support site. I have a grist card and I still can't make an in-app purchase. Why can't I make an in app purchase?
I think it is telling you to contact itunes support, which is exactly what you should do
-
Why can't I make an in app purchase on my ipad. I'm trying to buy something for 49.99 and I have 50.00 on my account from a gift card I just bought.
As RG says, if you're in the US, you haven't allowed for the sales taxes charged by your city and state. You'll need to buy something less expensive, add a credit card, or redeem an additional iTunes card.
Regards. -
Why can't i install a free app?
Why can't I install a free app? I click on free and then it tells me that I need to verify my payment option when the app is free. What am I doing wrong?
If you set up an Apple ID with credit card details then you need to enter valid credit card information and then when you download a free app it does what you are experiencing. You will not be charged. Sometimes when you update credit card information in you Apple ID, Apple raises a $1 charge to check to see if the card works and then cancels the charge. IF you want to set up an ID without a ccredit card then you do so like this
http://support.apple.com/kb/ht2534
01101001 01110000 01101000 01101111 01101110 01100101 00100000 01110100 01101000 01100101 01110010 01100101 01100110 01101111 01110010 01100101 00100000 01001001 00100000 01100001 01101101 -
HT4009 Why can't I make an in app purchase
Why can't I make an in app purchase
Note:
Some In-App Purchases require a Credit Card.
To Contact iTunes Customer Service and request assistance
Use this Link > Apple Support iTunes Store Contact -
Why can't I pin bookmark as apps ?
I can see the new feature is amazing - pin tab as apps but unfortunately one of the key thing i love about firefox is the ability to clear history and everything when i exit firefox. If I select this, then the pinned apps disappear according to forum posts and my own experience (using firefox 4 now).
But seeing as my bookmarks don't disappear when i exit firefox, why can't I pin bookmarks as apps then? It would be similar in function only difference would be it would not save my session/passwords etc which is what I want.
Any idea or is this feature already available?This used to work before I updated to Firefox 9.1.0. This is so aggravating!!
I still have 4 pinned websites from before the update but now I cannot Pin anymore!!
I can remove them, I just can't add more!!!!!!!!!
Why do developers ALWAYS have to go an f*** with things that work just fine???
<i><edited for language by Moderator></i> -
Why can I not download a free app? It says I have a billing problem but that's not true.
Hi friend,
Probably in the past you tap for a update inside the application, that made you have a pending payment in your Apple account. Go to www.apple.com and check about pending payments. If you have, wait for around 30 days (starting to count from the day you asked for the paid update) then it will be canceled automaticaly.
Hope it helps -
Hello, for some strange reason I cannot open any of the apps I have. I have tried turning the ipad on and off and this doesn't work. I can open everything else (videos, camera, etc) just no apps. Can anyone help please?
If it's the apps that you've downloaded from the App Store, but not the Apple built-in ones, then try downloading any free app from the store (as that appears to reset something) and then re-try them - the free app can then be deleted.
If it's all apps including Apple's then try closing them all completely and then see if they work when you re-open them : from the home screen (i.e. not with any app 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of each app to close them, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
If that doesn't work then you could try a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.
Maybe you are looking for
-
Acrobat 9 Pro, v9.5.5 Slow to Load
my issue is acrobat 9 pro, v9.9.9 is slow to load (take 45 to over 100 seconds to either load from Start menu of file manager - Window 7 Home Premium, sp1, 64 bit - acrobat has been installed for years, this started with 9.5.4 and is the same und
-
Extend Inventory Management (0IC_C03) with new field MSEG-INSMK
Dear Experts, We are using Business Content InfoCube "Material stocks/movements" (0IC_C03) in Area "Inventory Controlling/Inventory Management" in BW. We are using following Business Content DataSources: Stock Initialization for Inventory Management
-
Best Practices for BI, ADF and Oracle Forms installations on Weblogic
Hi, I'm researching options on upgrading to Oracle 11g Middleware. My company currently has Oracle Forms 10g running on Oracle Application Server. We are interested in using Oracle Forms 11g, ADF and Jdeveloper, and Business Intelligence with Oracle'
-
Transaction Launcher in CRM 7.0 reverts back to CRM view.
Hi Experts, I have configured all the necessary setting required for transaction launcher but still cannot launch it. The issue is when i launch it, it directs me to the logon screen of target system (ERP/ECC). Once i give my userid/psw, system think
-
Application in debug mode?
I want to look at some shared objects in the Media Server administration page, but when I click on them I get the error "Failed to make a debug connection." Does the main.asc have to be running in the development environment in order to view the cont