View unanswered posts | View active topics



Reply to topic  [ 13 posts ] 
FD4 Mobile debug testing screen size? 
Author Message
Member

Joined: Sat Dec 03, 2011 11:18 pm
Posts: 13
Hi, sorry for my bad english I hope you understand:

I'm working with a IOS project in FD4 RC2, when I press Ctrl + Enter to test the project, the screen size is not what I set on "dimensions" field of the project properties panel.

I read in the run.bat console "(hint: edit 'Run.bat' to test on device or change screen size)"
but my knowledge of batch language is limited and I don't know how to set a custom screen size.
I hope you can help me.


Sat Dec 03, 2011 11:36 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 11364
Location: Paris, France
Afraid of batch scripts? Are you a real coder?

Open this Run.bat and see around line 17 how the screen size is set by default to a “NexusOne" screen size. You can comment (using "::") this line and uncomment the line with "iPhoneRetina". For more sizes, open the url indicated in the comment just before and you'll find a table with predefined device screen sizes.

PS: this script can target directly your device; look in the "target" section line 6 and you should be able to figure how to choose another target than the desktop AIR debug launcher.


Sun Dec 04, 2011 2:49 pm
Profile WWW
Member

Joined: Thu Jan 26, 2012 8:51 am
Posts: 1
Hi! I need your help/advice =)

Problem: Mobile app. Control's dimensions differs running on desktop and on device.

Description: I've created a blank Flex4 Mobile Project in FD with 2 buttons. I've runned it on desktop and installed and runned on device (SamsungGalaxyS).
Buttons on desktop looks smaller. If I put 5 buttons - on desktop they take 75% of the screen, and go out of the screen on mobile.

I've installed FlashBuilder and created here the same app and the app looks very close to device.

All projects had same SDK, screenSize=nexusOne, applicationDPI=160 (setted in root mxml).

Any thoughts? What i'm doing wrong? :)

System:
1. Win7 x64, FlashDevelop 4.0.0 RC2, FlexSDK 4.6.0, AIR 3.1
2. WinXP SP3, FlashBuilder 4.6.0, FlexSDK 4.6.0, AIR 3.1


Thu Jan 26, 2012 9:08 am
Profile
Member

Joined: Fri Jan 20, 2012 2:56 pm
Posts: 23
Hi,
I don't know how to debug my application correct. It runs as is it should on the iPhone, but when i want to debug it on desktop, landscape doesn't work.
My App should run in landscape mode only:
i set it in FD under AIr Application Properties -> Initial Window -> Aspect Ratio: Landscape

in the code I use:
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;

Now I want to use the values of
stage.fullScreenWidth and stage.fullScreenHeight for positioning the graphical elements.

It works correct when i run the run.bat to build the ipa, on the iphone everything looks right.
But when I run goto desktop the height and width values are not landscape, they are portrait.
But the window is in landscape.
Is this a bug or am I doing sth wrong?

Thanks

Version: FlashDevelop 4.0.0 RTM, Air & Flex installed with the FD installer


Thu Jan 26, 2012 2:17 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 11364
Location: Paris, France
You don't need to set "stage.displayState".

You must listen to stage's RESIZE event because your app window size won't be correct at startup.

When run on desktop you may have to change the SCREEN_SIZE var in Run.bat, as described in Adobe doc:
http://help.adobe.com/en_US/air/build/W ... -8000.html


Thu Jan 26, 2012 3:27 pm
Profile WWW
Member

Joined: Fri Jan 20, 2012 2:56 pm
Posts: 23
ok, thx.
I'm still confused:

Run.bat
Code:
:desktop
:: http://help.adobe.com/en_US/air/build/WSfffb011ac560372f-6fa6d7e0128cca93d31-8000.html

::set SCREEN_SIZE=NexusOne
set SCREEN_SIZE=iPhoneRetina


Code:
public function Main():void
{
         stage.scaleMode = StageScaleMode.NO_SCALE;
         stage.align = StageAlign.TOP_LEFT;
         //stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
         
         trace("Before Event stage.fullScreenWidth " + stage.fullScreenWidth + " stage.fullScreenHeight " +stage.fullScreenHeight);
         trace("Before Event stage.stageWidth " + stage.stageWidth + " stage.stageHeight " +stage.stageHeight);
         
         stage.addEventListener(Event.RESIZE, stageResize);

}


Code:
private function stageResize(e:Event):void
{
         removeEventListener(Event.RESIZE, stageResize);
         
         trace("RESIZE EVENT");
         trace("After resize stage.fullScreenWidth " + stage.fullScreenWidth + " stage.fullScreenHeight " +stage.fullScreenHeight);
         trace("After resize stage.stageWidth " + stage.stageWidth + " stage.stageHeight " +stage.stageHeight);
}


Result:
Before Event stage.fullScreenWidth 640 stage.fullScreenHeight 960
Before Event stage.stageWidth 320 stage.stageHeight 480
RESIZE EVENT
After resize stage.fullScreenWidth 640 stage.fullScreenHeight 960
After resize stage.stageWidth 640 stage.stageHeight 960
RESIZE EVENT
After resize stage.fullScreenWidth 640 stage.fullScreenHeight 960
After resize stage.stageWidth 960 stage.stageHeight 640
RESIZE EVENT
After resize stage.fullScreenWidth 640 stage.fullScreenHeight 960
After resize stage.stageWidth 960 stage.stageHeight 640

Questions/Conclusion:
1. Why is the resize event fired 3 times? The event listener is removed by the first time, so at least the traces should only appear 1 time?

2. The first fullscreen stage dimensions are right, except the landscape/portrait thing. The stage.stageWidth is at first the one which are set in
Project -> Properties -> output -> Dimensions

3. At the end the stage.stageWidth & stage.stageHeight are the right ones i want to use, but with these events fired 3 times it's a little bit tricky to be sure that the right ones are used.

4. On the device I don't have to bother with all these stage resize thing if if i just use the fullscreen.width and height. It's always right when landscape mode is set in the Initial Window settings in FD


Thu Jan 26, 2012 4:19 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 11364
Location: Paris, France
Well you don't remove the listener on the right object so of course you continue receiving events.

Why so many events? Ask Adobe.

You want to have the right dimensions? Wait like 100ms.


Thu Jan 26, 2012 7:08 pm
Profile WWW
Member

Joined: Fri Jan 20, 2012 2:56 pm
Posts: 23
Quote:
Well you don't remove the listener on the right object so of course you continue receiving events

hehe, alright. But if i had done it right, i would never know that the event is fired 3 times :wink:

should be:
Code:
stage.removeEventListener(Event.RESIZE, stageResize);


Quote:
You want to have the right dimensions? Wait like 100ms.

Don't want to wait 100ms for settuping up my GUI.
Ok, since it's working on the device, I'm using hardcoded values for the desktop debugging.

Thanks!


Fri Jan 27, 2012 11:56 am
Profile
Member

Joined: Sun Apr 12, 2009 5:57 pm
Posts: 6
i am using this class (i take no credit its by coenrats i believe)
Code:
   public class StatesUtil
   {
      public static const PLATFORM_IOS:String = "ios";
      public static const PLATFORM_ANDROID:String = "android";
      public static const PLATFORM_QNX:String = "qnx";

      public static const PORTRAIT:String = "portrait";
      public static const LANDSCAPE:String = "landscape";
      
      public static var platform:String;

      protected var _target:UIComponent;
      
      /* static initializer */
      {
         switch (Capabilities.version.substr(0, 3).toLowerCase())
         {
            case "ios":
            {
               platform = PLATFORM_IOS;
               break;
            }
            case "and":
            {
               platform = PLATFORM_ANDROID;
               break;
            }
            case "qnx":
            {
               platform = PLATFORM_QNX;
               break;
            }
         }
         trace("Platform: " + platform);
      }
      
      public function set target(target:UIComponent):void
      {
         if (target == null) return;
         _target = target;
         _target.addEventListener(Event.RESIZE,
            function(event:Event):void
            {
               updateState();   
            });
      }
      
      public function get isTablet():Boolean
      {
         return _target.height > 960 || _target.width > 960;
      }
      
      public function get orientation():String
      {
         return _target.width > _target.height ? LANDSCAPE : PORTRAIT;
      }
      
      public function updateState():void
      {
         var newState:String;
         if (platform != null)
         {
            newState = platform + (isTablet ? "Tablet" : "Phone") + orientation;
            if (_target.hasState(newState))
            {
               _target.currentState = newState;
               trace(_target.currentState);
               return;
            }
         }
         newState = (isTablet ? "Tablet" : "Phone") + orientation;
         if (_target.hasState(newState))
         {
            _target.currentState = newState;
            trace(_target.currentState);
            return;
         }
         newState = orientation;
         if (_target.hasState(newState))
         {
            _target.currentState = newState;
            trace(_target.currentState);
            return;
         }
         trace("can't set new state");
      }
      

in use a 2 containers that sfter i know that i can use the stage, or de orientation mode use, i believe that everey mobile app uses a container to load what we think is the startup , what i mean is the listeners are there already even when u dont add them or trie to disable, again this is what i think, i am also playing with it, wanna make a basic thingie for 3 platforms,
got it working with flashbuilder but i am a fd diehard :)

this is my run.bat
Code:
set PAUSE_ERRORS=1
call bat\SetupSDK.bat
call bat\SetupApplication.bat
:menu
echo.
echo Package for target

echo  [1] 480                720 x 480               720 x 480               
echo  [2] 720                1280 x 720              1280 x 720               
echo  [3] 1080               1920 x 1080             1920 x 1080             
echo  [4] Droid              480 x 816               480 x 854               
echo  [5] FWQVGA             240 x 432               240 x 432               
echo  [6] FWVGA              480 x 854               480 x 854               
echo  [7] HVGA               320 x 480               320 x 480               
echo  [8] iPad               768 x 1004              768 x 1024               
echo  [9] iPhone             320 x 460               320 x 480               
echo  [10] iPhoneRetina       640x 920                640x 960                 
echo  [11] iPod               320 x 460               320 x 480               
echo  [12] NexusOne           480 x 762               480 x 800               
echo  [13] QVGA               240 x 320               240 x 320               
echo  [14] SamsungGalaxyS     480 x 762               480 x 800               
echo  [15] SamsungGalaxyTab   600 x 986               600 x 1024               
echo  [16] WQVGA              240 x 400               240 x 400               
echo  [17] WVGA               480 x 800               480 x 800     
echo.

:choice
set /P C=[Choice]:
echo.
if "%c%"=="1" set SCREEN_SIZE=480
if "%c%"=="2" set SCREEN_SIZE=720
if "%c%"=="3" set SCREEN_SIZE=1080
if "%c%"=="4" set SCREEN_SIZE=Droid
if "%c%"=="5" set SCREEN_SIZE=FWQVGA
if "%c%"=="6" set SCREEN_SIZE=FWVGA
if "%c%"=="7" set SCREEN_SIZE=HVGA
if "%c%"=="8" set SCREEN_SIZE=iPad
if "%c%"=="9" set SCREEN_SIZE=iPhone
if "%c%"=="10" set SCREEN_SIZE=iPhoneRetina
if "%c%"=="11" set SCREEN_SIZE=NexusOne
if "%c%"=="12" set SCREEN_SIZE=QVGA
if "%c%"=="13" set SCREEN_SIZE=SamsungGalaxyS
if "%c%"=="14" set SCREEN_SIZE=SamsungGalaxyTab
if "%c%"=="15" set SCREEN_SIZE=WQVGA
if "%c%"=="16" set SCREEN_SIZE=WVGA
echo.
echo Starting AIR Debug Launcher with screen size '%SCREEN_SIZE%'
echo.
echo (hint: edit 'Run.bat' to test on device or change screen size)
echo.
adl -screensize %SCREEN_SIZE% "%APP_XML%" "%APP_DIR%"
if errorlevel 1 goto error
goto end

:error
pause

:end


Thu Mar 01, 2012 3:00 am
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 11364
Location: Paris, France
Interesting but isTablet() will say the latest Android phones are tablets (1280x720).


Thu Mar 01, 2012 8:17 am
Profile WWW
Member

Joined: Sun Apr 12, 2009 5:57 pm
Posts: 6
Philippe wrote:
Interesting but isTablet() will say the latest Android phones are tablets (1280x720).

yeah but we have to put limits to our targets.. anything above ...., we cant please evereybody , but if the aim is to make a app for the main devices avaible, and also for the desktop, first of all u are like a freakin hero to me, so thanks for replying i am more a dot net programmer, but love the freedom of templating even do msbuild stuff .proj, or NANT the copycat of ant, combined with i will post this one later, i got a little thingie that it call pluginsweeper, it basicly just disables and also temp, removes or copy the config files
so start up with all and 3 options native, flash , or mobilestuff, and disable , and after that option debugs or not, dont wanna debug dont need 5 plugins, copy the dll files to a temp dir, and also acording to that choice removes the sniplets and templates. not remove but move.
u are a coder so u know that any process started in a threath is owned ,so i start flashdevelop with a small watch thingie, this makes me the owner of any dll's loaded after and always mutex, if u make a plugin that uses some of the maingui, and u embed it, u have the 2 of them, and a restart will kill the main , but not the activated plugin, took me like ages to find out why it was getting slowwwwwwwwww
and i can hook, before so can redirect rather then embed i want tha output native, the output panel or any compiling , should never, effect the ide of fd, all outside of the main app and plugincore.
i just adjust what i dont like, what i mean is if u wanna hang a painting u can have like a a room shitload of expensive good tools , but just one screwdriver and one screw that fits and one drill, will make u much more happy, so i try to make all i do so cloud-portable as possible
just start ask what do u wanna do , and load all that stuff after, and also all the vars, and even set windows path vars acording but always temp since i started up with a starter that one is the one that puts the ant/sdk/android shit at run time in the syspath when i close that one it is gone, i noticed that it made a huge difference in speed
THIS Is not relevant if you just have one comuter this is all perfectly done, and it is not neeeded, just think it is cool that i can just plugin a usbstick anywhere and yes even have a portable jdk :) that when i plug it out that there are no traces
so improved what u already made with the personal templates/projects dir an option to switch that by just restarting, depending on what u wanna do, also made a few runtime lazy loaded vars from dropbox or any that u can make static like username,sdk, compilersettings and paths in plain text files.
so i can also backup the settings in portable mode, i just need that coz i am always on the road..

so just wanna thank you , sure i can use sharpdevelop or avalon, or notepad, but i want just one proggie and well, flashdevelop ever since scite my number one, when i needed to do anything with flash. even on a 4000mhz with 6gb RAM , it will still take 40 seconds.
to load and compile,fd 15 seconds ,and will even do it withouth the ide ;) And well i guess i got just one person to thank for that..
and just wanted to give credits,
and ask if should post a few thingies that are normal to me.. portable fdz unzipper. asks where u wanna have it
and the whole svb solution flashdevelop project, i made some nant files, so you can compile just the whole thing with switches , withouth having visual studio installed,
just numbers
1 do coreplugins ,2 do flashdevelop ide, 3 do other plugins
4 combine all the settings and stuff from another dir.
5. make a unique plugin template outside with a always chaning guid, so you can play with it, and it aint hard, but it took me months to figure out .and works the best with the settings just one level higher then fd itself

When u are a noob and open the solution file as it is well..... :)
Just feel like after 4 years of using i should do something back.
And want other people to see how easy it is to do anything u want, and not to get stuck by embeding fd.exe, or overwrite the dll's just use them in the code etc :),
and since i am starting fd with a bootstrapper i can just say -usedebugplugins , and the one i love the most, -likealzeimer, no history etc :)
Please let me know if u need any beta testers, since adobe decided to killl ubuntu, i am using that code in virtualbox to debug in emulators and it works like a charm
Thanks and sorry for the long reply but needed to really point out why i am thankfull
Greetz Peter
ThaStyle


Thu Mar 08, 2012 5:41 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 11364
Location: Paris, France
@ThaStyle: tl;dr


Mon Mar 12, 2012 9:23 am
Profile WWW
Member

Joined: Sun Apr 12, 2009 5:57 pm
Posts: 6
Yeah to much talk, i know, still if u read it, u dont find no bullshit and only a person that pays respect and ask to help.
(although he was drunk)
;)


Fri Apr 06, 2012 8:59 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 13 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.