| |
|
|
|
1. When is Flex 2.0 coming out, what will be in Flex 2.0?
|
| |
Flex 2.0 is currently in Beta 3. You can try it out at Adobe Labs.
It is anticipated Flex 2 will be out sometime in mid 2006, however there are no confirmed dates.
Flex 2.0 is a complete overhaul of the Flash player, engine, and language. It is broken down into a free framework/compiler, an optional IDE called FlexBuilder 2 based on Eclipse with optional Charting, and a Flex Data Services (formerly known as Flex Enterprise Services, which replaces the Flex 1.5 Server).
Flex 2.0 no longer requires the need of a server to compile Flex apps - this is done using the IDE or the SDK. The FDS (Flex Data Services) adds extended abilities to do things like Java Remote Objects, Messaging, Paging through data, etc...
The accompanying version of the Flash Player will be version 9, and a major update to Coldfusion called Mystic adds support for Flex 2 connectivity, as well as optional integration to FDS.
|
| |
|
|
|
2. When will Flex for .NET be available?
|
| |
Macromedia has not announced a date.
|
| |
|
|
|
3. How can I search the Flexcoders Archive?
|
| |
http://www.mail-archive.com/flexcoders@yahoogroups.com
|
| |
|
|
|
4. How do I integrate Flex with IIS?
|
| |
The "Integrated JRun" install does not support IIS connectors. If you are using full JRun or Coldfusion, see the link below, and for other application servers see their documentation. http://www.macromedia.com/go/96611248
|
| |
|
|
|
5. Can I dynamically instantiate a WebService or HTTPService in ActionScript
|
| |
Flex 1.5 does not support this. Declare the tags in mxml. Then manipulate the urls, and request objects, etc. using ActionScript. See the simple examples on www.cflex.net, beginners tips, and see the Cairngorm Framework's Service Locator pattern for a more fully realized solution.
|
| |
|
|
|
6. Can I load CSS stylesheets dynamically at runtime?
|
| |
Dynamic loading of CSS files is not supported in Flex. CSS in Flex is processed on the server side during MXML compilation rather than on the client side at runtime.
There is a trick though: a CSS file can be compiled into a separate SWF file and loaded dynamically into the application using the Loader component. More information on this topic can be found on Manish Jethani's blog:
http://www.livejournal.com/users/mannu/286686.html
|
| |
|
|
|
7. When I set visible="false", the component still takes up space and is in the tab order
|
| |
You can often achieve the "display=none" effect by setting the height/width to 0 when you set it invisible, then back to a fixed value or to undefined, when you make it visible again.
|
| |
|
|
|
8. How do I report a bug or request an enhancement?
|
| |
http://www.macromedia.com/go/wish
|
| |
|
|
|
9. Why are my ValueObject member variables undefined in the results from my RemoteObject requests?
|
| |
The Flash Player deserializes objects in a special order that can confuse developers used to object serialization from other RPC systems. When a strongly typed object is returned to the player it first creates an instance from the prototype of the registered class without calling the constructor. It then populates the object with the properties sent in the result and finally, it calls the constructor without arguments. If your ValueObject constructor expects arguments to initialize an instance be sure to check whether arguments were actually sent to the constructor before overriding member variable values. Note that the Flash Player does not currently honor getter/setter properties in object serialization or deserialization.
|
| |
|
|
|
10. Why do strongly typed objects appear as "undefined" in the NetConnection Debugger?
|
| |
The NCD is an old utility from the early days of Flash Remoting that some developers still find useful. It has an issue, however, displaying types that have been registered with Object.registerClass(). If your flex server is installed locally we suggest enabling server side "debug" level logging in /WEB-INF/flex/gateway-config.xml to watch the raw trace information in the Flex server console / logs from the AMF Gateway as it processes your RemoteObject requests. Flex Builder also includes a Network Debugger that allows you to monitor AMF traffic.
|
| |
|
|
|
11. How do I get access to the J2EE session from my RemoteObjects?
|
| |
The AMF Gateway provides access to the current HttpServletRequest instance in a thread local variable. The session can be obtained from the request as follows:
flashgateway.Gateway.getHttpRequest().getSession();
|
| |
|
|
|
12. Can I resize the IE browser window from Flex?
|
| |
Use getURL() to communicate with javascript in the HTML wrapper:
getURL('javascript:window.resizeTo(1050,900)');
|
| |
|
|
|
13. Can Flex apps communicate with each other on the client?
|
| |
See the LocalConnection API In the documentation.
|
| |
|
|
|
14. Is double-click supported on various components?
|
| |
Flex 1.5
Unfortunately double-click is not supported by default. If you wish to add this functionality to say a List or DataGrid component, you will have to add the following AS2 code to your application:
// used to detect a double-click
var someTimestamp:Number;
...
/**
* Double-click handler for some DataGrid component.
*/
public function doubleClickHandler( evt:Object ):Void {
var now = getTimer();
// we got a double-click
if( ( now - someTimestamp ) < 500 ) {
// do something here ...
}
someTimestamp = now;
}
Flex 2.0
The MouseEvent supports a Double Click event. Eg: addEventListener(MouseEvent.DOUBLE_CLICK, doubleClickHandler);
|
| |
|
|
|
15. Errors with "macromedia.css.LocatorParser" class and WebLogic
|
| |
What is going on is that WebLogic ships with its own version of the fop.jar, which in turns includes the batik.jar, which is older and breaks Flex. In order to resolve this issue, remove the fop.jar from the CLASSPATH in the startWebLogic.cmd file.
This may apply to non-WebLogic servers as well where batik.jar was included.
|
| |
|
|
|
16. What does "The URL is not in the Proxy's whitelist." mean?
|
| |
The whitelist is a security feature in Flex that requires you to explicitly define which URLs a data service call can access.
You set this by editing the file: ...\[flexroot]\WEB-INF\flex\flex-config.xml.
There are three sections, one each for WebService, HTTPService, and RemoteObject. Be sure you are editing in the correct section! Each has a subsection called , which contains nodes. To enable an url for access by a Flex dataService call, enter that url between the tags.
For development phase ONLY, you can allow global access with the wildcard rows. The flex-config file is heavily commented. Open it up and you will see more detailed instructions.
|
| |
|
|
|
17. Sometimes, if I don't move the mouse, "click" and "mouseDown" don't work.
|
| |
This is a focus issue with the Flash Player, usually when the UI changes "underneath" the mouse pointer, as in a ViewStack navigation where the buttons are in the same screen location.
A work around is to add this property to the button tag:
trackAsMenu="true"
|
| |
|
|
|
18. Can I make my own Right-Click or "context" menu?
|
| |
Flex (or, more correctly, the Flash Player) does have the notion of a context menu that can be configured - check the docs for details:
However, there is a limitation of the current player (version 7 and below) where the context menu can only be shown on components inside the root container (ie. mx.core.Application.application). You can get around this by having the context menu on the root object and changing its dynamically at runtime depending on which component the mouse is over, but its a bit more work for you.
|
| |
|
|
|
19. myTreeNode.label or myTreeNode.attributes.label is undefined
|
| |
Make sure you use the TreeDataProvider methods to modify a node, don't rely on the node being XML. For example, the above should be myTreeNode.getProperty("label")
|
| |
|
|
|
20. When I add or modify an item in my dataProvider, why doesn't it show up in my DataGrid.
|
| |
Low-level methods like Array.push() or myArray[0] = "whatever" do not cause the dataProvider's modelChanged event to fire.
When working with a dataProvider, it is always best to use the dataProvider API. In the above example, you might code: myDataProvider.addItem(myItemObject) to add an item or use editField() to programatically modify a value. See "dataProvider" in the Flex API documentation:
http://livedocs.macromedia.com/flex/15/asdocs_en/index.html
Alternatively, you can call myDataProvider.modelChanged yourself, or re-assign the dataProvider to the control: myDataGrid.dataProvider = myDataProvider;
|
| |
|
|
|
21. My Tree displays just fine, but why can't I access the node attributes?
|
| |
Select a node in your Tree. In ActionScript, you can reference this node by saying: myTree.selectedNode;
To access the attributes of the node use the tree DataProvider API. These methods will work for any format dataProvider item, which might be an object or an array or an xml node.
For example, myTree.selectedNode.attributes.myAttribute MIGHT work,
but : myTree.selectedNode.getProperty("myAttribute"); is far more reliable.
See dataProvider and treeDataProvider in the on-line API documentation: http://livedocs.macromedia.com/flex/15/asdocs_en/index.html
|
| |
|
|
|
22. Can I create an app in Flex, compile it into a standalone swf, and run it on a machine without the Flex server?
|
| |
Flex 1.5:
This is technically possible.
However, the Flex license requires the presence of a Flex server, and SWFs compiled using the Developer version of Flex will expire in 1 day. Review the license carefully.
If you have a special business case, contact your Macromedia sales rep, as they are often willing to discuss special agreements.
Flex 2.0:
This is the norm. You use the SDK or FlexBuilder IDE to compile your Flex Clients; they'll be out of the box ready to work with HTTPService's, WebServices, and Coldfusion RemoteObjects. Optionally the new Flex Data Services can be used to hook into Java POJO's, and utilize data paging, messaging/rtmp, etc...
|
| |
|
|
|
23. How do I pass parameters to a popup window?
|
| |
Tracy Spratt has put together a very simple example that you can download here: http://www.cflex.net/ChannelFiles/1/popupexample2.zip. Details regarding how this works can be read via http://www.cflex.net/showfiledetails.cfm?objectID=197.
|
| |
|
|
|
24. What does "Branch between ... and ... around line ... exceeds 32K span" mean and how do I get rid of it?
|
| |
Don't panic. Your app is NOT too big for Flex to handle. True, the 32k limit is a real Flash Player limitation to the size of certain structures like if blocks and for loops. But you don't really care about that right now, because you don't have any direct control over those things. Here is some information that will help you get back to coding:
There are two main reasons you might the 32k issue. The primary cause, and the one to address first, is the architecture of your application code. The 32k error message asks you to "refactor" your code. Refactoring is essentially the process of modifying the structure of your source code while keeping the same functionality. In the Flex world, this means moving some parts of the code out of a main file and into separate components. One way to do this is to use custom mxml components. So instead of, say, having several hundred lines of mxml in a child container of a ViewStack, you put that mxml code into its own component file, and have a single line in the ViewStack to reference it. Do that for all the ViewStack children and 1000 lines of code can become 30. Decreasing the total number of visually rendered mxml tags in a single file will help avoid the 32k limit. Another type of refactoring is to move ActionScript code into its own class. Important note! Just putting the AS code into a file and then using the #include directive or the mx:Script source="myscript.as" method to include the code will NOT help with the 32k problem. You MUST create a true AS class that contains the functionality. Around two thousand lines of mixed mxml and AS code and you are in danger of the 32k error. I have not found an upper limit whatsoever to code length in a class.
The second cause of the 32k error is not your fault. During compile, Flex generates AS code out of your mxml source. Then it compiles that into the Flash swf. In that process it makes decisions on how to break up your source and generate the AS class code. In Flex version 1.5, it doesn't always make the right decision, and the result is the 32k error. IF you are confident that you app is already efficiently "refactored", and you suspect you might be at one of these boundary conditions, first try compiling the app with ?debug="true" in the url. If the app compiles, then you are surely at a boundary condition. What is happening is that debug adds code to your source during generate/compile. This additional code causes Flex to change the structure of the AS classes so that the 32k limit is not hit. Hmm, more code? Yeah. Try just adding 50 or so lines of code, even if it is bogus. Usually, this will get you working. Now, when you add more real code go on and remove the bogus stuff, you don't want it in your production code!
A final hint. After hitting a 32k error, and trying one of the above solutions, if you still get the error, delete the temporary generated as code. It is located in ..\MyAppServer\flex(flexroot or contextroot)\WEB-INF\flex\generated\*. You can delete all the folders safely (make sure to restart your Flex server).
This can be an aggravating and somewhat scary problem, and it always seems to happen just before an important demo. Just use good, modular design, and remember the bogus code trick. Macromedia has stated a committment to improving this situation in the next release.
|
| |
|
|
|
25. What does "Warning: Changes to unknown property, ..., will not be detected" mean and how do I get rid of it?
|
| |
Generally speaking, binding needs type information to set up its change detection functionality, and anything that hides this info can cause this problem.
- Don't use mx.core.application.application.myVariable in binding.
- If you are passing a reference to some component into another component via public properties, type the property variable definition as specifically as possible.
- When using "dot.down" notation to specify a property in an object or model, cast it to a type: text="{String(myObject.whatever.firstName)}"
|
| |
|
|
|
26. Is there a Rich Text Editor?
|
| |
With the current Flex 1.5 component set, there is no Rich Text Editor unfortunately. There are some limitations in the current Flash Player that make such an editor difficult though there are implementations out there people have used. Macromedia has heard many requests for a Rich Text Editor and has indicated there might be better support in a future release.
There is a third party component called the FlashTextEditor that can be integrated.
Flex 2.0 will include the mx:RichTextEditor tag.
|
| |
|
|
|
27. How to run Flex as a Service?
|
| |
Flex is not a server that you deploy and run, it is simply deployed as part of your web application. So whatever web container you are using, either Tomcat, JRun 4, WebLogic, etc... so long as you can run any of those as services, then it will work. To learn how to deploy Tomcat, JRun 4 or any other Java server as a service, please refer to the appropriate documentation for the server you are using.
|
| |
|
|
|
28. Does Flex work on my platform?
|
| |
Probably, search the archives if you have a specific question about your platform before posting to the list.
|
| |
|
|
|
29. How do I get Flex to query my database?
|
| |
Flex does not have any native database integration functionality. you will require some server-side tier that will do the database access and send the data back to Flex via one of three protocols:
- RemoteObjects: Fastest. communicates with server side EJB's or POJOs using AMF, a binary, compressed format.
- HTTPService: uses HTTP protocol. Sources can be JSP, ASPx,.NET, files, any url that returns HTTP.
- WebService: Slowest. Uses SOAP protocol. Sources can be .Net, or any WebService.
|
| |
|
|
|
30. I'm sending my request, and I see the data traffic in the command window, but the result is always empty.
|
| |
You are probably trying to read the result immediately after the send(), right, expecting synchronous behavior? You can't do this. See "How do I make synchronous data calls?"
|
| |
|
|
|
31. How do I make synchronous data calls?
|
| |
You CANNOT do synchronous calls. You MUST use the result event. No, you can't use a loop, or setInterval or even doLater. This paradigm is quite aggravating at first. Take a deep breath, surrender to the inevitable, resistance is futile.
There is a generic way to handle the asynchronous nature of data service calls called ACT (Asynchronous Call Token). Search for this in Developing Flex Apps doc for a full description, but here it is in a nutshell. This example uses HTTPService but will be similar for RemoteObject and WebService:
- First, create a function to handle the data return, like "onResult()"
- In the HTTPService tag, put this function name in the "result" property, passing in event.
- Invoke the call in script:
//invokes the call to the HTTP data service
var oRequestCallbject = app.mxdsGetData.send(oRequest); //we will use this string value in the result handler.
//Yes, you CAN set this AFTER you invoke send()
oRequestCall.MyQueryId = "WhateverIWanttoUseToIdentifyThisCall" ;
- In the result handler, which will be called every time the data service call returns, you identify what the returned data contains like this:
var callResponse = oEvent.call; //get the call object
//gets the value of this property you set in the call
var sQueryId = callResponse.MyQueryId; //will be "WhateverIWanttoUseToIdentifyThisCall";
trace(sQueryId);
You can use this sQueryId value in a switch to do the correct processing. Alternatively, you can pass reference to a handler function directly.
|
| |
|
|
|
32. When I have only a single record, it does not display in my DataGrid
|
| |
This is a known issue that is caused by Flex's inability to differentiate between an object and an array with a single row. the solution is to ALWAYS use "toArray()". Here are some examples:
In MXML: {mx.utils.ArrayUtil.toArray(modelAccidents1.accidents.accident)}
And the inline format: dataProvider={mx.utils.ArrayUtil.toArray(testSrv.result.result.error)}
And in ActionScript: myControl.dataProvider = mx.utils.ArrayUtil.toArray(testSrv.result.result.error)
|
| |
|
|
|
33. I have two alerts in my code, but they are displaying in reverse!
|
| |
Actually, it is worse than that. Alerts, and "Modal" pop-up windows are not truly modal. They prevent user interaction with the interface, but they do NOT block code execution. What is happening is that both alerts are displaying, and the second one is on top of the first. The way to get the behavior you want is to use events and handlers. Your code must display the alert or modal pop-up, then end. When the user dismisses the prompt, you then complete the processing. You should be able to find some examples if this on one of the sites listed in "Resources"
|
| |
|
|
|
34. The columns in my DataGrid are in some strange order!
|
| |
The order is typically the reverse of the order in which they were added. If
you need a specific order, specify that and many other good things by using
DataGridColumn tags. See the docs.
|
| |
|
|
|
35. Can I embed HTML in my Flex application?
|
| |
Flex supports a limited subset of HTML in its TextArea and some other text-
related classes. There is also a new article by Christophe on his blog
discussing how to fake HTML with an IFRAME (http://coenraets.com/viewarticle.jsp?articleId=95).
|
| |
|
|
|
36. How can I make FlexBuilder faster?
|
| |
Flex 1.5: In order to improve FlexBuilder performance, it is best to disable the "Design View". This can only be done in FlexBuilder 1.5 and to do so, please follow these steps:
- Select "Preferences" under the "Edit" menu
- In the "General" section, remove the check mark next to "Enable MXML Design View"
- click on "OK"
Flex 2.0: The best thing you can do is disable the "Build Automatically" option. Uncheck Project -> Build Automatically from the menu and you should see increased performance, especially during save operations. Also, if you're not using a project make sure that you close it to free up memory.
|
| |
|
|
|
37. Flex Builder debug does not stop at breakpoints in components
|
| |
The safest way to set breakpoints in component files is to use the Files
list. Start the debugging session, nav you app to where you want to start
debugging. Click the "Files" button on the Debug Toolbar, or go Menu
Debug\Files. Select the component you want, usually the .mxml or .as files. The
list strips out underscores in filenames, and can be very long, but this method
always works. FB will open a temporary file, set the breakpoints, and away you
go.
|
| |
|
|
|
38. Are there frameworks available for Flex?
|
| |
Cairngorm: http://www.iterationtwo.com/open_source_cairngorm.html FlexUnit: http://www.iterationtwo.com/open_source_flexunit.html SynergyFLEX: http://www.mossyblog.com/archives/473.cfm (this link is for 1.0.0a) ARP: http://www.osflash.org/projects/arp/about ASUnit: http://www.asunit.org
|