how to use mx components?  
Author Message
spookmc





PostPosted: 2007-2-11 23:19:35 Top

flash-actionscript, how to use mx components? I am very confused, trying to use the mx.components (e.g.
mx.managers.PopUpManager).

I cannto see in my Flash 8.0 Professional edition where to find the mx
controls.
Nor do I understand how to acces the controls for my applications.

Undoubtly, this is a very trivial question, but I cannot find the answer :-(

Can anyone help me with a little hint ?

 
SwedKim





PostPosted: 2007-2-12 0:20:00 Top

flash-actionscript >> how to use mx components? - Drag a component to the Layer
- Select this component
- Now go to the menu and choose Window > Properties > Parameter
- Now you can see "parameter" for the component

Example
Drag ComboBox under User Interface to a Layer
Select the ComboBox
go to Window > Properties > Parameter
You will find 4 options data, editable, labels, rowCount
double-click on labels, add some labels and ..... good luck


 
spookmc





PostPosted: 2007-2-12 4:39:00 Top

flash-actionscript >> how to use mx components? thanks for the answer.

I tried to find the combobox elelemnt and I found it under the components
panel.
Now I want to add the mx.managers.PopUpManager.
To be exact, I want to use the method: popupmanager.createPopUp
I have Flash 8 professional, but I cannot figure out how to use this component
/ class?
What is it?? is it a component?? It is not in the components panel.
Where can I find it?? Everybody talks about it in forums like it is a very
normal thing ot use, but I cannot find it ...

 
 
LuigiL





PostPosted: 2007-2-12 4:49:00 Top

flash-actionscript >> how to use mx components? Attached code comes from the help-files.



/**
Requires:
- Window component in library
*/

import mx.managers.PopUpManager;
import mx.containers.Window;

System.security.allowDomain("http://www.flash-mx.com");

var my_win:MovieClip = PopUpManager.createPopUp(this, Window, true,
{closeButton:true, contentPath:"http://www.flash-mx.com/images/image1.jpg"});
var winListener:Object = new Object();
winListener.click = function() {
my_win.deletePopUp();
};
my_win.addEventListener("click", winListener);

 
 
spookmc





PostPosted: 2007-2-12 5:05:00 Top

flash-actionscript >> how to use mx components? Thanks for your interest in my problem.
I am beginning to get a grasp of what I need to do.
(I have understood by now, that mx.managers.PopupManager is a Class, and I
even located it on my harddisk as an .aso file)

I created some working example from this code (shows two windows though)

The code I want to replace by the CreatPopUP is:

[I]this.dialogClip = createEmptyMovieClip("dialogClip",
this.getNextHighestDepth());{/I]

Now I cannot have a window in the library because this code is in an as file
(defining a Class in AS1.0)

How should I change this line to be replaced by PopUpManager??


 
 
LuigiL





PostPosted: 2007-2-12 6:04:00 Top

flash-actionscript >> how to use mx components? >>defining a Class in AS1.0
I think you mean AS2?
The PopUpManager controls popups of Window Components. Whether you write a
class or code on the timeline doesn't make any difference for the items you
have in the library. In your class you can reference the items in the library.



import mx.managers.PopUpManager;
import mx.containers.Window;

class myPopUp {

public function myPopUp(target:MovieClip){
var my_win:MovieClip = PopUpManager.createPopUp(target, Window, true,
{closeButton:true, contentPath:"http://www.flash-mx.com/images/image1.jpg"});
var winListener:Object = new Object();
winListener.click = function() {
my_win.deletePopUp();
};
my_win.addEventListener("click", winListener);
}

}

//in the fla (with a Window Component in the library
System.security.allowDomain("http://www.flash-mx.com");
var popup:myPopUp=new myPopUp(this);

 
 
spookmc





PostPosted: 2007-2-12 6:48:00 Top

flash-actionscript >> how to use mx components? Thanks a lot for explaining the logic. that's what I was looking for.
Right now I use :
[I]this.dialogClip = createEmptyMovieClip("dialogClip",
this.getNextHighestDepth());[/I]

to create a container for ( code copied from the help-files):
[I]drawRoundedRectangle(dialogClip, this.dialogClip.width,
this.dialogClip.height, 20, 0xAA1199, 20);

function drawRoundedRectangle(target_mc:MovieClip, boxWidth:Number,
boxHeight:Number, cornerRadius:Number, fillColor:Number, fillAlpha:Number):Void
{
with (target_mc) {
beginFill(fillColor, fillAlpha);
moveTo(cornerRadius, 0);
lineTo(boxWidth - cornerRadius, 0);
curveTo(boxWidth, 0, boxWidth, cornerRadius);
lineTo(boxWidth, cornerRadius);
lineTo(boxWidth, boxHeight - cornerRadius);
curveTo(boxWidth, boxHeight, boxWidth - cornerRadius, boxHeight);
lineTo(boxWidth - cornerRadius, boxHeight);
lineTo(cornerRadius, boxHeight);
curveTo(0, boxHeight, 0, boxHeight - cornerRadius);
lineTo(0, boxHeight - cornerRadius);
lineTo(0, cornerRadius);
curveTo(0, 0, cornerRadius, 0);
lineTo(cornerRadius, 0);
endFill();
}
}
};[/I]

If I understand it right, this won't be possible using the PopUpManager, since
it is not a Windows Component?
So I cannot dynamically create the MovieClip to be shown.
Am I right?
Can I really only use Window Components clips with the popup, or is there a
workaround to fill in other MovieClips to be shown as popups?

Again, thanks a lot for teaching me the logic behind the trics :-)

 
 
LuigiL





PostPosted: 2007-2-12 17:53:00 Top

flash-actionscript >> how to use mx components? Yes, the PopUpManager works with Window Components to show and hide popups. For
the content of the popup you can provide a movieclip in the library which has a
linkage identifier.
When you don't want to use the Window Component you can write your own
popupmanager class that creates modal and non-modal popups.

 
 
spookmc





PostPosted: 2007-2-12 22:23:00 Top

flash-actionscript >> how to use mx components? OK, now I understand the use of the popup manager; and now I am back where I
started ...

To make my own popup functionality, I have to make all other classes stop to
react to mouseclicks when the popup is open.

How can such a thing be done? I have to make adjsutments to all the other
objects in my movie that react to mouseclicks...
What is the workaround to be used? Or in other words: how can i make the one
movieclip be the only one to react to mouseclicks. (how can I make all the
others stop 'listening'?)

 
 
LuigiL





PostPosted: 2007-2-12 22:34:00 Top

flash-actionscript >> how to use mx components? Nope. The trick is to draw a background right under the popup (which of course
is at the highest depth) and then use assign an onRelease event for the
background that does nothing. Then you have the equivalent of a modal popup.

 
 
spookmc





PostPosted: 2007-2-12 22:48:00 Top

flash-actionscript >> how to use mx components? OK, thanks a lot for teaching me :-D

If I understand you correctly: I should find a function to copy the whole
stage into an image (jpg?) and have this copy placed in a new MC, to be shown
directly below the popup.
This MC covers the rest of the objects on teh stage and so it prevents tehm
from being clicked.

Can I easily perform this "print stage" to create a screengrab of the current
background?

 
 
LuigiL





PostPosted: 2007-2-12 23:41:00 Top

flash-actionscript >> how to use mx components? No, you just draw a shape with a black (or any other color) fill at the size of
the stage and set the alpha to zero. An onRelease handler on that shape will
still hide all other events handlers.
You might have seen the effect that when the popup pops up, the stage dimms a
liitle. Well, that's that background shape that fades in over time to an alpha
of about 30.

 
 
spookmc





PostPosted: 2007-2-13 5:15:00 Top

flash-actionscript >> how to use mx components? Thanks a lot for helping. I solved the problem almost now :-)

I created a MC: backGroundClip with the Stage-sizes, made it transparent and
defined
backGoundclip.onPress = function(){}
Now I can only "click" the MC's in front of this backGroundClip.

Only problem left seems that I cannot use the Keys anyomore.
I used to have a spacebar interaction with the top-MC (the popup) to scroll
through the options...

Can anyone reflect on this unexpected behavior??