02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Changing the ScaleMode in Adobe AIR

Now that we got our application to rotate as we see fit we will discover our first problem. The main issues is that we just don't like what we are seeing. In the next step we will need to start configuring how we want the content to scale. So we will take deep dive into the world of scaling content. We take a look at all the possible ways we can scale content in our application.

Video Transcript

00:00Now by default Adobe Air will try to get your content to fit into the area
00:05So if our application was in this size
00:08It can't make it bigger than this area because if it would some of the content wouldn't get in
00:13What do I mean by that? Let me show you what I mean by that if we come here into our application
00:17I'm just gonna put your another layer and in this layer. I'm just gonna put here a nice little color
00:21I'm just gonna figure out a little color here like green and I'm gonna put it this layer underneath go to the square area
00:29I'm just gonna zoom out and I'm gonna make sure that I'm gonna
00:32Basically capture all of our currently visible stage
00:36Once I do that and I click on V and I just take my element and push it let's say to the middle here
00:42Not that it matters too much and I'm gonna go into my control and I'm gonna test my movie again
00:47Once I test my movie again, you'll see once everything is loaded. We'll see our application, right?
00:51And just give us a second here for the simulator to load as well and be ready
00:55Once the simulator is set up and ready. I'm gonna click on the auto orient again now that we could auto orient and all our
01:03Configurations are correct. I'm gonna come here and I'm gonna rotate my device and notice how this is the region of our content
01:09The reason is because by default Adobe flash and also air will try to get all of our content into our closed
01:16dimensional area without basically stretching and
01:20Resizing our content you could change those defaults as well
01:24Now I want to show you how to change those defaults
01:27To change those defaults. I'm gonna go right back out there and this time around we're gonna create some code
01:31So I'm gonna come here into my I create a new layer for action script
01:36select my empty frame and
01:38In my actions group frame what I want to do
01:41The first step that I want to do is I want to basically reconfigure the scale mode
01:45Alright, so let's see how we do that basically I'm gonna import the stage port the stage modes possible in a stage mode
01:51So I'm gonna import import
01:55I'm gonna import the flash display dot
01:59stage
02:00scale mode
02:01Once I do that
02:02I could go right away to my stage and reconfigure my stage and the way I do that is I go to the scale mode
02:07Property and in the scale mode property. I have a few different options in my stage scale mode as static properties
02:14One is exact fit the other is no border the other is no scale and one is show all
02:20So let's go through them really quickly
02:21So exact fit which is what exact fit does and I'm just gonna save it and make it run really quickly is exact fit
02:29Automatically fits everything in our content inside basically not caring about ratios or anything of that nature
02:36So I'm just gonna wait for my simulator to load up and I'm gonna auto orient again
02:40And I'm gonna rotate my device and notice how all the information is now smashed and squished
02:45Which is usually not something that we would want to happen, but it's something that you could do
02:49All right, so that is option number one
02:51Let's look at our next option beyond that
02:54We have no border which basically means that will ignore the fact that the flash has a containing that Adobe air has a containing area
03:01So let me just save that and run it again
03:03And by the way, I'm running it using the command return because I'm on the Mac or you'd be using the control command
03:10The control enter I believe if you're on a PC or you could go through the menu
03:14So once we got that set up
03:16I could again set the auto orientation this time rotate our device again and notice how it just doesn't care about the size of the flash
03:23It's basically
03:24Resizing our content to fit the maximum that it could fit inside when it's not oriented
03:30Which is again probably not saying that we'd want to do unless there's some sort of
03:34Image or video or something that we'd really just want to zoom right into it or something of that nature
03:39That might be a good configuration for us such as taking the full screen area. All right, so we saw the two options
03:45We saw basically the exact fit and the no border which both are interesting options
03:50The other one is no scale and the no scale option will basically not change anything in our content and just center our content
03:57Which is a possible option?
03:59You probably would want to use that in a case where you want to add more information
04:03So maybe you're playing a video game and you don't want the elements in the game to grow
04:07But instead of that you want to give the user more space to see so that could be a very very plausible
04:13Scenario and in the no scale again, once we get everything to load up
04:17We'll see there once we rotate the information nothing in our content will scale. So we're going to see this again
04:24And once it loads up, we're gonna re enable it
04:27And I'm gonna rotate and notice how nothing is scaling
04:30We're not resizing our content is staying in the exact same dimensions as it was before and we're not doing anything to it
04:37All right. So that is another option that we have now. This is a really great scenario
04:43Because if you were playing a game, you might just want to rotate the game panel without changing absolutely anything besides maybe
04:50Re-shifting maybe areas of the content inside such as the score of the game or something of that nature
04:55And all you'd really want to do is rotate your your your area by 90 degrees without changing actually anything beyond that
05:02That might be what you want to do and we'll see we'll take a deeper look into how you could do that in a later
05:06Video actually not that later probably the next video. Alright, so let's see what our last configuration that's left
05:12We the last one that we didn't see which we actually saw which is the default which is show all the show all all default
05:19Configuration will basically get every all of our information into the region that we have
05:25Basically scaling our information and shrinking it to fit into our system
05:29Which is exactly what we saw in our first example, which was our default configuration
05:33So in this case once we really once we rotate our application and once our simulator will finish loading
05:40We'll see when we auto-oriented re-enter and we actually rotate our element
05:44We'll see how our everything is fitting inside because we're scaling our proportions down to fit everything inside
05:50So those are the four basic configurations that you could work with now, obviously the default auto
05:56Orientation doesn't really work that well
05:59Because you don't really want to scale everything down and forget about everything in many scenarios and some scenarios you do
06:05But in many other scenarios, that's just not the behavior you're wanting
06:10For example, if there's no meaning to the content such as maybe it's an image
06:14You might want to just rotate that image with you without changing anything in it
06:18All right, so we're gonna see more into that in the next video

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!