I retrieved a fine component for drawing in flex. It uses some floating toolpalette like:
toolBox = PopUpManager.createPopUp( this, ToolPalette ) as ToolPalette;
I tried to integrate that component into a new flex MXML component like a tileWindow:
Works fine except that these tools palette are OUTSIDE the component.
Is there a way to constrain the toolBox created with PopupManager to stay within its parent container ?
regards
I used createPopUp when the popup component was "titleWindow". But when I want a Canvas component added in the popup, I created a titleWindow and added the Canvas component as a child to the TitleWindow.
var titleWindow:TitleWindow;
titleWindow=new ResizableTitleWindow();
titleWindow.showCloseButton=true;
//Canvas Component
var toolPalette:ToolPalette=new ToolPalette();
// Add the Canvas component to the Titlewindow
titleWindow.addChild(toolPalette);
PopUpManager.addPopUp(titleWindow, this, true);
Set the modal property when you call the createPopup method to true.
createPopUp(this, toolPalette, true, null)
By deffinition on adobes site no you can not constrain
createPopUp -- Creates a top-level
window and places it above other
windows in the z-order.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/managers/PopUpManager.html#addPopUp%28%29
Thats' not saying you couldn't try to create a mask of some sort
Related
Is it possible to create a display object in AS and take a screenshot of it as ByteArray or whatever without adding it to stage?
You can do this with any DisplayObject using BitmapData http://blog.728media.com/tag/bitmapdata/ . Note that in Flex, components that have not been added to the stage may not lay out properly until you give them a width and height and call validateNow() on them.
So, I have a component based on canvas, and within that component I have two images. I have the component listen for a click and when that event occurs one image goes transparent and the other becomes visible.
This part works perfect.
Now, on clicking that component, I also want to do something to the parent canvas, I already have this working for more basic types (image, canvas, text, etc) but the problem with my component is that the click event has the internal image as the target, so what I want to happen to the outside canvas is happening to the canvas of the component.
How do I make my component as a whole the target of any clicks on it?
3.5 SDK
You can make the outer component the target of the clicks by setting mouseChildren = false on the outer component. Clicking anywhere within the component (including on any of the sub-components) will then set the event target to the outer component. Hope that helps.
I handled this by adding a click handler to the children that would stop immediate propagation, then dispatch a click event from the outer component. Wade's solution is much better.
I am trying to use the ProgressBar Flex component inside a custom Actionscript 3.0 component derived from the UIComponent class. I have set the minimum and maximum values etc.
_progressBar = new ProgressBar();
_progressBar.label = "Loading";
_progressBar.minimum = 0;
_progressBar.maximum = 100;
_progressBar.direction = ProgressBarDirection.RIGHT;
_progressBar.mode = ProgressBarMode.MANUAL;
The component shows the "Loading" text but not the loading bar.
Anything like _progressBar.setProgress(20, 100) does not have any effect on the code. Any ideas why this is not working?
The problem is that I was adding the component to a UIComponent. Flex components need to be added to something derived from a container like a Canvas. I could not get buttons to display in my custom component derived from UIComponent. Changing it to Canvas fixed the issue. Hope this helps someone.
There is no problem with the current code you have provided (it works fine in an individual instance).
Perhaps the problem lies in your custom AS3.0 component, but without further information it's not possible to assist you.
One of my decoration bitmaps covers up some important elements in my flex application. The problem is these elements become not clickable. How could make the bitmap not clickable or how could I pass the click event along to those children elements below?
You could have a common container for both the bitmap and the elements you need to access , since a bitmap is not clickable , the container itself needs to be clickable and listen to the mouse click event you need to dispatch, also make sure that:
//"this" refers to the container
this.mouseChildren = true;
The basic idea is that if your elements are in another container under the bitmap, the bitmap will act as a screen, if the elements are in the same container , the bitmap cannot screen the mouse events since the container itself is the EventDispatcher.
You can set mouseEnabled = false on mx.controls.Image or whatever container the bitmap is loaded into.
I'm aware of PopUpManager and that custom modal windows can be created.
But let's say I have a simple Canvas(or any component) and when I show it the background needs to be blurred out like how PopUpManager does when a new pop-up is shown.
Is this possible?
Not without a lot of work. The PopupManager puts a blur on Application, and then puts the popup in front of the Application, but as a child of the SystemManager, so it's a sibling to the Application in the display list rather than a child. You could take a screen shot of the Application, run a blur filter over it, and place it as the last child of Application, and then place your component on top of that, but if you do that you might as well just use PopupManager in the first place.
I think the blurring has to do with how you set the alpha level on the component.