Archive | Flex

Reloading a Flex Application Via URLRequest and application.url

Mon, Sep 22, 2008

Comments

url Reloading a Flex Application Via URLRequest and application.url
Here is how you can reload a Flex Application Via a Click of a button using the Application.application.url property

<code>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
xmlns:mx="http://www.adobe.com/2006/mxml"
 layout="vertical" backgroundColor="0xFFFFFF">
	<mx:Script>
		<![CDATA[
			private function onReloadFlexApp():void
			{
				var urlRequest:URLRequest = new URLRequest(Application.application.url);
				navigateToURL(urlRequest,"_self");
			}
		]]>
	</mx:Script>
 
 
		<mx:Button label="Click Here to Reload" click="onReloadFlexApp()"/>
 
 
</mx:Application>
</code>
Continue reading...

Adding History Management to Components in Flex

Mon, Sep 22, 2008

Comments

histmanag Adding History Management to Components in Flex
Say You want to have the states of your Components in Flex save themselves so a user can navigate using the back and forward buttons of the browser. This is a possible by implementing the mx.managers.IHistoryManagerClient and supplying the saveState and loadState Methods with what property of the component you would like to save. This example implements the mx.managers.IHistoryManagerClient for the ToggleButtonBar and allows you to navigate back and forth with the browser buttons without leaving the flex application. Click the Buttons first and notice how the URL Bar Changes. Navigate Back and Forth.Click Here for Example and Source Code . In order for this to work you need to access directly the HTML file wrapper and not the swf file.

Continue reading...

Using the ImageSnapshot Class in Flex to take a Snap Shot of a component

Mon, Sep 22, 2008

Comments

snapshot Using the ImageSnapshot Class in Flex to take a Snap Shot of a component
This Example shows you how to take a Snap Shot/Screen Shot of a flex Component using the ImageSnapShot.captureBitmapData() method. It is pretty simple so look at the example and click the button to take a snap shot. Source View is Enabled. Click Here for the Example

Technorati Tags: Component SnapShot, Flex, SnapShot Flex

Continue reading...

Passing Paramaters using HTTPService in Flex to ColdFusion

Sun, Sep 21, 2008

Comments

http Passing Paramaters using HTTPService in Flex to ColdFusion
This Example involves passing parameters from Flex to ColdFusion and then having ColdFusion Process what we need and sending it back to flex via flashvars. The HTTPService class is much slower than say using the RemoteObject class or even the WebService class but If you are not doing any heavy lifting like this example then you should not be seeing any performance difference. Instead of a CFC file we use a CFM file and the parameters being passed are actually in the URL of the CFM file and not to a function. For Example when You Enter your name it will be like http://mySite.com/myFile.cfm?yourName=ColdFusion. Click Here for the Example and the Source Code is Enabled.

Technorati Tags: ColdFusion CFM, flashvars, flex HTTPService Example, HTTPService Flex, RemoteObject, WebService

Continue reading...

RemoteObject Class in Flex and ColdFusion Example

Sun, Sep 21, 2008

Comments

remoteflex RemoteObject Class in Flex and ColdFusion Example
This Example uses the RemoteObject Class/MXML Tag in Flex to send some parameters to a ColdFusion CFC file, the ColdFusion CFC file then processes the parameters that Flex sent it then sends the results back which we display in Flex.  The Example is simple and straightforward and you can use this as a stepping stone to create bigger applications. You can, for example query up a Database from ColdFusion then have flex send some parameters which ColdFusion can take and determine for example to delete,insert,filter, something from the Database.  A couple of things you need to take note of. 1) You must set the destination=”ColdFusion” or you will get this error:

[RPC Fault faultString="[MessagingError message='The MessageAgent's destination must be set to send messages.']” faultCode=”InvokeFailed” faultDetail=”Couldn’t establish a connection to ””]

Also When you drill down to the CFC file make sure that you are Starting from where the root of your site is and to also include the src Folder in flex. So For Example myExample.src.ThisIsTheCFCFile, DO NOT put the .cfc Extension. Here is the Example, just type in Your First Name and Last Name and click Submit. Click Here for the Example and Right Click For the Source

Technorati Tags: CFC, CFM, CFML, ColdFusion, Flex, RemoteObject, RemoteObject Example

Continue reading...

1000: Ambiguous reference to setStyle

Sun, Sep 14, 2008

Comments

flexles2 1000: Ambiguous reference to setStyle
The error is 1000: Ambiguous reference to setStyle. It took me a while to find a solution, It happens when you are trying to set a style, for example: setStyle(”w”,50) in Flex and at the same time you are using the mx_internal namespace. For Example

use namespace mx_internal;
private function dummyTest():void
{
var mainSelector:CSSStyleDeclaration 
          = StyleManager.getStyleDeclaration("VadexTabBar");
if(!mainSelector)
{
mainSelector = new CSSStyleDeclaration();
}
mainSelector.defaultFactory=function():void
{
 
}
mainSelector.setStyle("tabWidth",500);
StyleManager.setStyleDeclaration("VadexTabBar",mainSelector,false);
}

Solution to the Problem:
Instead of opening all the namespace and having “use namespace mx_internal” on top, just selectively open up the namespace “mx_internal::property”, and don’t include use namespace mx_internal on top.For example

private function set navItemFactoryInternal(value:Class):void
		{
			mx_internal::navItemFactory =new ClassFactory(value);
		}
Continue reading...

Flash Player Text Engine Examples For Flex 4 (Gumbo)

Sun, Sep 14, 2008

Comments

flexles Flash Player Text Engine Examples For Flex 4 (Gumbo)

So the New Flash Player 10 will be coming out with a Text Engine that is a significant improvement over what we have right now as of Player 9. There are around 32 new classes that you have so far, give or take a few. The Example that I have provided is pretty simple and the explanations are within the source code.  All I am doing for all is choosing a font that I want, and choosing a couple of formatting styles. The Text has some sort of rotation in all 4 styles. Now If you don’t have the fonts that I used then you are probably going to see a different style. So make sure that you have these fonts : Times Roman, Geneva, Webdings, and Verdana or you can just copy and paste the code in Flex Builder and change it to whatever fonts you want to use.
(more…)

Continue reading...

Creating a Link to the Context Menu In Flash Player 10 for Flex 4 (Gumbo)

Wed, Sep 10, 2008

Comments

So Here is How you can add a link to the ContextMenu in Flash Player 10 for Flex 4, Now The Example is pretty straight forward and simple. However, I have not figured yet a purpose or what the use for it could be. To test the example, right click on the image. Click on Copy Link Location, go to the Browser Bar and Paste and You will see the URL of the link which would be to this site.
(more…)

Continue reading...

Flex 4 (Gumbo) Using FileReference to Upload & Download without a Server

Wed, Sep 10, 2008

Comments

So in Flash Player 9, You couldn’t upload Files/save the files and have some sort of interaction with it without sending it to Server side scripts. Now, for example in Flash Player 10, a user can upload his/her word document and then be able to save it to his computer after he/she is done editing it without you having to store it on the server.

Another example would be working with Pixel Bender and interacting with the file that the user uploaded. You can now apply filters without ever having to send it to the server.

So in other words you have access to files at runtime. Now I did an example back then but It had some problems with a bug in the Flash Player 10. Now you can only upload and save Text files (*.txt). However, the only problem that I could not find a solution for is that you can not change the file name. You have to accept the name I have set otherwise it will save without an extension.
(more…)

Continue reading...

Using the Ellipse Tag and the Group Tag in Flex 4 (Gumbo) to create a mask

Wed, Sep 10, 2008

Comments

Here is another Simple Example To create a mask in Flex 4 (Gumbo), All I am doing is creating a couple of Ellipse’s using the Ellipse tag and positioning them to where I want them to be. Example and Source.
(more…)

Continue reading...

Page 1 of 71234567»