Antibiotics > Cephalexin 500mg Pills > 180 Pills > $267.00

ActionScript 2.0 Flash

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 It’s not hard to make a SWF resize itself to the dimensions of the browser.  All it takes, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 in fact, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 is to set the width and height attributes of the HTML’s <object> <param> element and/or <embed> element to 100%.  There are a number of ways to determine the SWF’s display, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 too:  show all (default) makes the entire movie visible while maintaining the original aspect ratio of the SWF (if the browser’s aspect ratio differs, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 you’ll get the equivalent of “letterbox” borders either horizontally or vertically); no border gets rid those potential borders, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 but may crop parts of the SWF instead; exact fit distorts the SWF, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 if necessary, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 to make the entire movie visible without borders or cropping.  See Adobe TechNote 12701 for complete details.

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 Fine and good.  Now, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 what if you want to allow the Stage to resize, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 but not its contents?  What if you want to adjust the position of various movie clips — such as a logo, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 navigation, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 or content area — in response to the Stage’s new dimensions as the browser is resized?  Luckily, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 that’s not hard either.  :)   Let’s take a look. 

An answer, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 short and sweet

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 Open a new FLA and draw a quick shape — a circle will do.  Convert the shape to a movie clip (Modify > Convert to Symbol…, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 then choose Movie Clip) and give the clip an instance name via the Property inspector.  For this example, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 let’s call it mcLogo.

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 Create a scripts layer and type the following into frame 1:

Stage.scaleMode = "noScale";
Stage.align = "TL";
var stageListener:Object = new Object ();
stageListener.onResize = positionContent;
Stage.addListener(stageListener);

function positionContent():Void {
   mcLogo._x = Stage.width - mcLogo._width;
   mcLogo._y = Stage.height - mcLogo._height;
}
positionContent();

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 Test your SWF, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 and you’ll see the circle hug the lower right corner as you resize the SWF’s dimensions in Flash.  Either that, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 or publish to an HTML file and set the width and height attributes for both the <option> <param> element and the <embed> element to 100% and resize the browser.

How it works

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 In the first line, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 we’re telling the SWF not to scale itself.  In your HTML — this is important — you’re going to set the width and height to 100%, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 but the SWF itself will not scale to fit those dimensions.  In the second line, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 we’re telling the SWF to register itself to its upper left (top left) corner.

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 Next, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 an arbitrarily named variable, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 stageListener, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 is declared as a generic Object instance.  This object acts as an “ambassador” for the Stage.onResize event, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 so we need to assign a function to a new onResize property of our object, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 rather than of Stage directly.  In this example, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 the function is arbitrarily named positionContent() and is defined shortly below.  Note:  if you like, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 you may assign a function literal …

stageListener.onResize = function() {
  // instructions here
}

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 … but in this case, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 I chose a named function because you may want position dozens of movie clips, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 and it’s arguably “cleaner code” to define the function separately. Antibiotics > cephalexin 500mg pills > 180 pills > $267.00  If you go the named function route, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 as we’re doing, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 make sure to omit the parentheses in this line, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 as shown.

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 The next line adds our ambassador as a listener to the Stage.  The Stage.addEventListner() method is what “wires up” the listener object to the object that dispatches the event (here, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 the Stage).

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 Finally, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 the custom positionContent() function tells mcLogo what to do.  In this case the movie clip’s _x property is set to the width of the Stage minus its own width.  That makes it hug the right side.  To center this clip, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 you could set its MovieClip._x property to half the Stage’s width minus half its own …

mcLogo._x = Stage.width / 2 - mcLogo._width / 2;

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 Follow suit for vertical positioning.  Makes sense, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 right?  Be sure to call the positionContent() function after you declare it, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 to make sure everything is positioned at the start, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 otherwise the Stage/browser would have to resize first.

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 By the way, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 this setup expects movie clips to be registered to their upper left corners.  If mcLogo’s shape was centered horizontally in its own timeline, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 you would only have to minus half its width from the Stage’s width to make it hug the right hand side.  If you want a 20 pixel buffer between this right-aligned clip and the Stage, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 account for that extra 20:

mcLogo._x = Stage.width - mcLogo._width - 20;

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 To keep a clip to the left side, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 set its _x to 0.

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 Keep in mind, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 you’re not limited to setting MovieClip._x and _y properties.  You may adjust a clip’s _width, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 _height, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 _xscale, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 _yscale … whatever you like.  Experiment and have fun with it!  For every clip you wish to position, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 simply add its entry to the positionContent() function.  Note, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 below, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 that an mcNav clip is being set to a position based on the original mcLogo clip.  Here, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 both clips would hug the right edge of the Stage, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 and mcNav would float below mcLogo, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 with a buffer of 20 pixels.

function positionContent():Void {
  mcLogo._x = Stage.width - mcLogo._width;
  mcLogo._y = 20;
  mcNav._x = Stage.width - mcNav._width;
  mcNav._y = mcLogo._y + mcLogo._height + 20;
}

Antibiotics > cephalexin 500mg pills > 180 pills > $267.00 Note:  See How to Fix Wrong-sized SWFs in Firefox to work around a common issue with 100%-sized SWFs in Firefox.  (Thanks for the cross-reference suggestion, antibiotics > cephalexin 500mg pills > 180 pills > $267.00 Markus!)

Average Rating: 4.7 out of 5 based on 229 user reviews.

Leave a Reply