Full Browser Flash Help

Get help on web editors (Frontpage, Dreamweaver) and web languages (HTML, ASP, PHP).
Post Reply
Buddha
Registered User
Posts: 62
Joined: 02 Nov 2004, 02:00

Full Browser Flash Help

Post by Buddha »

Hey there.

Im creating a FBF microsite for a project of mine, and im having issues with the creation of the GUI :P

Basically its a full page flush of a colour, a logo that is hovering center (always) and a nav bar that runs 'docked' to the bottom of the screen.

Here is the AS for the code.

Code: Select all


Stage.align = "TL";
Stage.scaleMode = "noScale";

// Center logo on load          
logo._x = Stage.width / 2;      
logo._y = Stage.height / 2;

this.createEmptyMovieClip("menu_mc", this.getNextHighestDepth());
    
	menu_mc.lineStyle(0, 0xC5946B, 100, true, "none", "round", "miter", 1);
	menu_mc.beginFill(0xC5946B);
	menu_mc.moveTo(Stage.width - Stage.width , Stage.height - 50);
	menu_mc.lineTo(Stage.width, Stage.height - 50);
	menu_mc.lineTo(Stage.width, Stage.height);
	menu_mc.lineTo(Stage.width - Stage.width, Stage.height);
	menu_mc.lineTo(Stage.width - Stage.width , Stage.height - 50);
	menu_mc.endFill();

bg.onResize = function() {
	var imageAspectRatio = this._width/this._height;
	var stageAspectRatio = Stage.width/Stage.height;
	if (stageAspectRatio>=imageAspectRatio) {

		this._width = Stage.width;
		this._height = Stage.width/imageAspectRatio;
	} else {

		this._height = Stage.height;
		this._width = Stage.height*imageAspectRatio;
	}
	this._x = Stage.width/2;
	this._y = Stage.height/2;
	
	// Center logo on resize
	logo._x = Stage.width / 2;
	logo._y = Stage.height / 2;
	
};

Stage.addListener(bg);
bg.onResize();
At the moment the page loads fine the 1st time. But if i place the code to draw the nav @ the bottom again in the resize loop... Well i get hundreds of nav bars as u resize :P

How do i go about making sure that when its resized the prev mc's are removed and a new 1 is done.

(my AS isnt as good as i thought so speak down to me all you like :P )

Thanks for any hints,

Buddha
maxxis
Moderator Emeritus
Posts: 8307
Joined: 30 Jun 2004, 02:00
Location: ( . Y . )
Contact:

Post by maxxis »

I don't see your code for repositioning the nav once the resize happens.

Try using this code instead. Ive commented where what needs to go.

Code: Select all



stop();


Stage.align = "TL"
Stage.scaleMode = "noScale";

//Align Non Scaled Objects on stage PRE-resize.

// Center logo on load         
logo._x = Stage.width / 2;     
logo._y = Stage.height / 2;

this.createEmptyMovieClip("menu_mc", this.getNextHighestDepth());
   
   menu_mc.lineStyle(0, 0xC5946B, 100, true, "none", "round", "miter", 1);
   menu_mc.beginFill(0xC5946B);
   menu_mc.moveTo(Stage.width - Stage.width , Stage.height - 50);
   menu_mc.lineTo(Stage.width, Stage.height - 50);
   menu_mc.lineTo(Stage.width, Stage.height);
   menu_mc.lineTo(Stage.width - Stage.width, Stage.height);
   menu_mc.lineTo(Stage.width - Stage.width , Stage.height - 50);
   menu_mc.endFill(); 



sizeListener = new Object();
sizeListener.onResize = function() {

//Align Objects post scale

// Realign Logo
logo._x = Stage.width / 2;     
logo._y = Stage.height / 2;

// Realign Menu

 menu_mc.moveTo(Stage.width - Stage.width , Stage.height - 50);
//   menu_mc.lineTo(Stage.width, Stage.height - 50);
//  menu_mc.lineTo(Stage.width, Stage.height);
//   menu_mc.lineTo(Stage.width - Stage.width, Stage.height);
//   menu_mc.lineTo(Stage.width - Stage.width , Stage.height - 50);


};
Stage.addListener(sizeListener);

Not sure wht the lineTo functions do but if its just positioning then your menu_mc.moveTo should redo the alignment.

Hope this helps/
Buddha
Registered User
Posts: 62
Joined: 02 Nov 2004, 02:00

Post by Buddha »

thanks for the quick response maxxis

Ill give it a try now.
maxxis
Moderator Emeritus
Posts: 8307
Joined: 30 Jun 2004, 02:00
Location: ( . Y . )
Contact:

Post by maxxis »

Let me know if you get stuck.

The way you create the menu is quite interesting.

Would like to see a sample of the page.
Buddha
Registered User
Posts: 62
Joined: 02 Nov 2004, 02:00

Post by Buddha »

meh... nah i think thats taking me further from where i wanna go. Can you PM me ur email and ill send u the files in a zip (with a demo html page so u can see what i mean?)
maxxis
Moderator Emeritus
Posts: 8307
Joined: 30 Jun 2004, 02:00
Location: ( . Y . )
Contact:

Post by maxxis »

Sent ;)
Post Reply