Solved

Position close button for Flash Window Component

Posted on 2007-11-26
7
1,404 Views
Last Modified: 2010-04-21
I'm using PopUpManager.createPopUp to create a popup window in Flash 8.  The close button is visible and working fine, but it is positioned toward the left edge of the popup header.  I want to position it in the standard place along the right edge.

How do I adjust the _x position for the close button?

Thanks.
0
Comment
Question by:gdejarnett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 20356216
By default, PopUpManager.createPopUp always keep the close button on right corner..

I suggest you to try my code as per the instruction given below:

1.
Create a new FLA (actionscript 2.0)

2.
Drag an instance of Window component in Library

3.
Create a new movieClip with LinkageID "my_mc" and dont keep any instnace on stage, we will attached it into window component as windows content
make sure, it must have minimum width of 200 and minimum height of 150.

4.
Now you should have only two items in library, Window component and my_mc movieClip with linkageID "my_mc" and stage should be empty

5.
Now Just copy paste the following code on frame one and compile the FLA to see the results.

I hope all should work fine.

-------------------
Aneesh Chopra
-------------------


import mx.managers.PopUpManager;
import mx.containers.Window;
//
var my_win = PopUpManager.createPopUp(this, Window, true, {closeButton:true, contentPath:"my_mc"});
var winListener:Object = new Object();
my_win.title = "Window Title";
// close btn
winListener.click = function(evt_obj:Object)
{
	trace("close button clicked");
};
 
winListener.complete = function()
{
	// size it as per the contents
	my_win.setSize(my_win.content._width,my_win.content._height+25);
	// center it 
	my_win._x = Math.round((Stage.width-my_win._width)/2);
	my_win._y = Math.round((Stage.height-my_win._height)/2);
};
my_win.addEventListener("click",winListener);
my_win.addEventListener("complete",winListener);
//

Open in new window

0
 

Author Comment

by:gdejarnett
ID: 20469930
Thanks Aneesh,

I am creating the popup window in a manner similar to your code.  This is why I am not sure why the close button is near the left edge of the window.  Is there a way to adjust the x position of the button via code?
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 20469997
I am not getting it left corner.
can say until I see what you are getting..

I suggest you to upload your FLA for review
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:gdejarnett
ID: 20774812
aneeshchopra,

The FLA file can be found at:
https://filedb.experts-exchange.com/incoming/ee-stuff/6723-ee.zip

If you will unzip the ee.fla as well as the 2 .as classes into the same directory and test it, you will see what I mean.

Thanks for taking a look at this.
0
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 500 total points
ID: 20776434
that so, I always said to upload the source file, because you have no where mentioned what all tweaks you have tried to customize window title bar..

without complete description no one can suggest to correct solution.

Ok,
issue was, you no where has set the height width of the "window" instance created by using "PopUpManager.createPopUp"

Just add code given below just after the following line of code and button position issue will be fixed:

add code below this line:
myTW.addEventListener("click",windowListener);

 
//add following code:
 
windowListener.complete = function() 
{
	myTW.setSize(myTW.content._width-20,myTW.content._height+25);
};
myTW.addEventListener("complete",windowListener);

Open in new window

0
 

Author Closing Comment

by:gdejarnett
ID: 31411115
Thnaks aneeshchopra,

That worked perfectly.  There is another 500-point question posted about this exact piece of code, but a different problem with it if you are interested.  It is located at http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Macromedia_Flash/Q_23111934.html

Thanks again,

Gary
0
 

Author Comment

by:gdejarnett
ID: 20778592
This solution worked perfectly.

I can now change the x position of the close button by changing the x value of the setSize method.  Is there any way to slightly adjust the y position of the button?  It would look better if it were slightly higher, but changing the second parameter in the setSize method has no effect.

Thanks.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Microsoft WSUS 4 116
Flash being Disabled - help! 20 345
Flash builder 4.13 list scroller does not work 1 57
Script to Delete registry entry based on Product name 6 187
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to record live broadcast.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question