How do you add resize functionality to flex components? - actionscript-3

I'm creating a flex drag and drop interface of sorts that will have a range of different components. Is there a standard way of adding resize handlers to a component or does the component need to be overridden?

Do you mean front-end resizing?
Senocular wrote an excellent transform class for that:
http://www.senocular.com/flash/tutorials/transformtool/
http://www.senocular.com/demo/TransformToolAS3/TransformTool.html

I found quite a useful example that is easy to implement. It gives support for changing cursors, setting bounds, rotation and fixed aspect ratio. I think its worth a look for anyone needing to add resize support.
https://github.com/marc-hughes/ObjectHandles/tree/master/flex-object-handles
The above link is a flex project download. Import the flex project and run the MoveAndResize.mxml example.

Related

StageWebView - hide just for JS

I want to use StageWebView just for communicating with a JS page, without actually showing it at all
Is this possible, and if so, what is the best recommended way of doing it?
Seems that not setting the viewport might accomplish this, as well as positioning the viewport offscreen
First you need the interaction, then you need to put the view off the stage. Take a look at RichWebView which is an alternative to StageWebView https://github.com/myflashlab/webView-ANE
As the documentation says, you can't do this with StageWebView.
The StageWebView class provides a simple means to display HTML content
on devices where the HTMLLoader class is not supported. The class
provides no interaction between ActionScript and the HTML content
except through the methods and properties of the StageWebView class
itself. There is, for example, no way to pass values or call
functions between ActionScript and JavaScript.
Using HTMLLoader you could do this.

Is it possible to use Flex UI components with Starling?

I am using Flex to build a web based viewer, although I can build it in a pure actionscript 3.0 project, but I thought using Flex will save us time building complex UI components ..
So, as the question implies, can we use those Flex UI components with starling?
Is it as easy as adding the UI component to the Starling ex .. starling.display.Sprite rather than to the conventional display list? is that all?
I hope I can find a clear answer here, otherwise Flex as an option will be questionable or canceled ..
Well?
Flex components inherit Flash sprites which are not the same as Starling's sprites. So the answer is no, Starling won't let you add a Flex component.
Flex component are coded using the native Flash display list, you would have to recode them entirely using Starling.

flsh component slider with as3 class--huh?

attempting to add a flash component slider to my as 3 class and I cant find any examples on the web. I am surprised at the number of funky home made sliders i am seeing. Maybe there is a problem with flash components and as 3? Could you leave a note if this is doable, and any rough direction you could provide. thnks!!
The examples in the AS3 docs should give you the information you need.
Reasons not to use the slider component:
It adds 32KB to the size of your SWF. Not a great option where file size is critical.
It's not that difficult to code a slider which may be more suitable to your needs.
I wouldn't be (haven't been) afraid to use the built-in slider component, though.
You do need to make sure the component is in your FLA library before compiling. Including the code in your AS will not do since I beleive Flash needs all of the visual elements present.

BorderLayout with GWT

How to achieve a true BorderLayout effect in GWT?
If possible without a library?
If I need to use a library, please not a payed one, neither a deprecated one?
From Kinjal's post, the 2.0 *LayoutPanel classes are almost certainly what you want. The DockLayoutPanel and its subclass the SplitLayoutPanel will provide this functionality in two different ways.
There are two important things about using Layout Panel classes. First, use a strict doctype (such as the html5 doctype). Second, all panels must be given a size and must be informed of resizes - this is why they all implement the RequiresResize interface.
The easiest way to do that is to start not with a RootPanel, but with a RootLayoutPanel - this will ensure that you get resize events from the browser window. Then, add in the layout panel of your choice, and it too will be resized.
If you build your own widget subclasses and want to be notified when resizing happens, you too should implement RequiresResize. Similarly, if you are building a widget subclass that will be sizing its children, you should implement the ProvidesResize interface.
Use HLayout or VLayout and set custom css style to achieve it.
You can also take a look at this Layout documentation

Add layout to Flex UIComponent

How can I add a layout (a HorizontalLayout to be specific) to a Flex UIComponent?
I'm working on a large mobile application, hence I'd like to avoid using additional containers like HGroups and work with more lightweight components.
As usual, any help would be greatly appreciated!
You can't and you don't really need to.
You can't, because only Spark components were designed with an encapsulated layout mechanism. mx components were not and you can't assign a layout to UIComponent.
You don't really need to, because Groups were already designed to be very lightweight containers without any graphical elements in them. Their only purpose is to layout other components.
Now if you really want to trim them down, you can always create your own copy of Group that contains only the properties you really need, but in my opinion that would be a huge time-waster for a barely (if at all) noticeable gain.