September 27th, 2007 by Kyle
Posted in: Flex, Coldfusion, Flex Data Services

This post is to carry on from my previous post regarding moving data from ColdFusion CFCs to Flex 2 Applications Using Webservices.

Here is the first sample showing basic retrieval of a string via Remote Object:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" >
    <mx:Script>
        <![CDATA[
            import mx.rpc.events.ResultEvent;
            import mx.controls.Alert;
           
            [Bindable]
            public var sResult:String;
           
            public function handleStringResult(event:ResultEvent):void{
                sResult=event.result as String
            }
        
        ]]>
    </mx:Script>
        
    <mx:RemoteObject
        id="myService"
        destination="ColdFusion"
        source="services.HelloWorld">   
        <mx:method name="sayHelloString" result="handleStringResult(event)"  fault="Alert.show(event.fault.message)" />
    </mx:RemoteObject>

    <mx:Label id="lblStringResult" text="{sResult}"/>   
    <mx:Button label="get String Remote Object" click="myService.sayHelloString()"/>

</mx:Application>
 

This movie requires Flash Player 9

Browse the source of this example.
Download a zipfile containing the source to this sample.

Read the rest of this post»


No Comments »

September 27th, 2007 by Kyle
Posted in: Flex, Coldfusion, Flex Data Services

  
I am using HostMySite as my web host and have the Linux Builder Plus CF package.
I haven’t upgraded to CF8 since that would require me to change my host package to use Windows. I don’t think I want that, since I like having SSH access to the machine my site is physically on.
I had just finished with my blog regarding Moving data from ColdFusion CFCs to Flex 2 Applications Using Webservices and was trying to get my code working on my site for the follow up article on Moving data from ColdFusion CFCs to Flex 2 Applications Using RemoteObject.
I was not being very successful and had even spoken with HostMySite support and they told me that accessing cfcs from Flex as RemoteObjects through the Flex Gateway with Coldfusion was not enabled and furthermore could not be enabled for a shared hosting account. If I wanted that functionality, I would have to upgrade to a VPS (Virtual Private Server) host package.

  
Now I pay about $65 per quarter for my host account for CF and Wordpress capabilities. The base VPS host package with Coldfusion starts at $116 a month. I don’t know about you, but that is quite a jump for me, so I decided to do a bit more digging around. As it turned out, I found a few forum entries that seemed to allude that it was possible. In fact, one person had even posted to a link in his hosted site where he actually had my dev center article remote object sample working! Unfortunately he didn’t quite say how he had accomplished such a feat.

  
Well I knew how I would deal with that mystery. I got out my trusty Web Debugging Proxy tool: Charles to sniff the request that the sample was making so I could see what the url was to the flex gateway. As it turns out, I was just missing a trailing slash on my flex2gateway URI!!!!!

The key to getting this to work revolves around 3 things:
1. Getting your config files located and configured properly for compilation.
2. Getting the fully qualified name for your cfc correct.
3. Knowing the endpoint URI for your Flex Gateway fro your Coldfusion server.

In Flex Builder in my project, I create the following 2 config files:

services-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<services-config>
    <services>
        <service-include file-path="remoting-config.xml" />
    </services>
    <channels>
        <channel-definition id="my-cfamf" class="mx.messaging.channels.AMFChannel">
            <endpoint uri="http://739saintlouis.com/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>
            <properties>
                <polling-enabled>false</polling-enabled>
                <serialization>
                    <instantiate-types>false</instantiate-types>
                </serialization>
            </properties>
        </channel-definition>
    </channels>
</services-config>
 

remoting-config.xml:


class="flex.messaging.services.RemotingService"
messageTypes="flex.messaging.messages.RemotingMessage">






** Read the rest of this post»


No Comments »

September 24th, 2007 by Kyle
Posted in: Flex, Coldfusion

One of my first blog posts pointed to a dev center article that I wrote on this topic for the Flex 2 release. I often send customers to look at this article when appropriate as it is a good starting point for webservice and remoteobject communication between Flex and Coldfusion. I also find myself referring to this sample once in a while and so I have finally decided to host the sample and cfc from my website/blog and potentially enhance the cfc to support more use cases for subsequent blog posts.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" >
    <mx:Script>
        <![CDATA[
            import mx.rpc.events.ResultEvent;
            import mx.controls.Alert;
           
            [Bindable]
            public var sResult:String;
               
            public function handleStringResult(event:ResultEvent):void{
                sResult=event.result as String
            }
           
        ]]>
    </mx:Script>
       
    <mx:WebService id="myService"
        useProxy="false"
        wsdl="http://739saintlouis.com/services/HelloWorld.cfc?wsdl"
        showBusyCursor="true">   
        <mx:operation name="sayHelloString" result="handleStringResult(event)" fault="Alert.show(event.fault.message)"/>
    </mx:WebService>
    <mx:Label id="lblStringResult" text="{sResult}"/>   
    <mx:Button label="get String via Webservice" click="myService.sayHelloString.send()"/>

</mx:Application>
 

This movie requires Flash Player 9

Browse the source of this example.
Download a zipfile containing the source to this sample.

Read the rest of this post»


No Comments »

September 17th, 2007 by Kyle
Posted in: Flex

Here is a simple little demo that shows how to create, style and position a tooltip so it looks like an Error bubble.
This way you can have more than one visible Error Tip visible at once.

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" styleName="plain"  verticalAlign="middle" horizontalAlign="center">

    <mx:Script>
        <![CDATA[
             import mx.controls.ToolTip;
             import mx.managers.ToolTipManager;
            
             private var errorTip:ToolTip;
            private var myError:String;
              
           private function validateEntryA(event:Object):void {
                myError="Error A.";
                errorTip = ToolTipManager.createToolTip(myError,event.currentTarget.x + event.currentTarget.width,event.currentTarget.y) as ToolTip;
                errorTip.setStyle("styleName", "errorTip");
           }

           private function validateEntryB(event:Object):void {
                myError="Error B.";
                var pt:Point = new Point(event.currentTarget.x, event.currentTarget.y);
                pt = event.currentTarget.contentToGlobal(pt);
                errorTip = ToolTipManager.createToolTip(myError,pt.x + event.currentTarget.width,pt.y) as ToolTip;
                errorTip.setStyle("styleName", "errorTip");
           }
        ]]>
    </mx:Script>

<mx:TextInput id="a" width="100" valueCommit="validateEntryA(event)"/> 
<mx:VBox>
    <mx:TextInput id="b" width="100" valueCommit="validateEntryB(event)"/> 
</mx:VBox>

</mx:Application>
 

Hopefully this will be useful to some.
Here is a link to a Flex Builder 2.0.1 project
(compiled with SDK hotfix2) containing a sample demonstrating the solution described above.


No Comments »

September 13th, 2007 by Kyle
Posted in: Flex, Flex Charting, actionscript, mxml

What should the LineChart do in this situation?
How can you draw a line with only 1 data point much less extrapolate the data??

Turns out that the Flex chart does not handle that very well. The solution?? Write your own lineSegmentRenderer.

Here is an example of a lineSegementRenderer that will just draw a circle for this case.

MyLineRenderer.as:

package
{
    import mx.charts.renderers.LineRenderer;
    import mx.charts.series.items.LineSeriesItem;   
    import mx.charts.series.renderData.LineSeriesRenderData;
    import mx.charts.series.items.LineSeriesSegment;   
    import mx.charts.renderers.CircleItemRenderer
    import flash.display.Graphics;
    import flash.geom.Rectangle;
    import mx.charts.ChartItem;
    import mx.charts.chartClasses.GraphicsUtilities;
    import mx.core.IDataRenderer;
    import mx.graphics.IFill;
    import mx.graphics.IStroke

    public class MyLineRenderer extends LineRenderer
    {
        private static var rcFill:Rectangle = new Rectangle();   
       
        public function MyLineRenderer()
        {
            super();
        }
       
        override protected function updateDisplayList(unscaledWidth:Number,
                                                      unscaledHeight:Number):void
        {
            var l:int=(data as LineSeriesSegment).items.length;
            if(l==1){         
                var item:LineSeriesItem=((data as LineSeriesSegment).items[0] as LineSeriesItem)
                var fill:IFill = GraphicsUtilities.fillFromStyle(getStyle("fill"));
                var stroke:IStroke = getStyle("stroke");
                       
                var w:Number = stroke ? stroke.weight / 2 : 0;
       
                rcFill.right = 2;
                rcFill.bottom = 2;
       
                var g:Graphics = graphics;
                g.clear();   
                if (stroke)
                    stroke.apply(g);
                if (fill)
                    fill.begin(g, rcFill);
                g.drawCircle(item.x, item.y, 3);
                if (fill)
                    fill.end(g);
            }
            else{
                super.updateDisplayList(unscaledWidth, unscaledHeight);   
            }   
        }      
    }
}
 

Read the rest of this post»


No Comments »

September 10th, 2007 by Kyle
Posted in: Flex

I had a customer ask how they could use a button itemRenderer in a tile list, have the buttons toggle, and keep track of all the toggled buttons so one could easily clear all the toggled buttons. Here is what I came up with:

The key to this is that if your TileList has a dataprovider that is an array collection, within an itemRenderer, each item’s BaseListData will have a UUID.
If you extend the Tilelist and add a public member that is an arrayCollection that is used to contain all the UUIDs of toggled buttons, then management of those toggled buttons become quite easy.

Here is my simple extension to TileList:

<?xml version="1.0" encoding="utf-8"?>
<mx:TileList xmlns:mx="http://www.adobe.com/2006/mxml"
    initialize="acToggledButtons = new ArrayCollection()">

    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            [Bindable]
            public var acToggledButtons:ArrayCollection;
            
            public function removeAll():void{
                acToggledButtons.removeAll();
                this.invalidateList();
            }
        ]]>
    </mx:Script>
</mx:TileList>
 

Read the rest of this post»


2 Comments »

September 6th, 2007 by Kyle
Posted in: Flex Charting

I worked on this sample with a customer to help debug some issues. I must confess, I don’t remember what I did and haven’t review the code to recall how this works, but it is a nice little sample. When you mouse over an item in the legend, the series in the chart glows and vice versa, when you mouse over an item in the chart, the corresponding item in the legend glows. Neato!

Here is the extension to the Legend class.

package{
import mx.charts.LegendItem;
import flash.events.MouseEvent;
import mx.containers.Canvas;
import flash.geom.Rectangle;
import flash.display.DisplayObject;
import flash.display.Sprite;

public class myLegendItem extends LegendItem
{
     private var bgElement:Canvas;
     private var _highlight:Boolean;
   
     public function myLegendItem()
     {
         super();

         addEventListener(MouseEvent.MOUSE_OVER, handleEvent);
         addEventListener(MouseEvent.MOUSE_OUT, handleEvent);
       
     }
     
     override protected function createChildren():void {
        super.createChildren();
        bgElement = new Canvas();
        bgElement.setStyle("backgroundColor", 0×00ff00);
        addChildAt(bgElement,0);
    }
   
    private function handleEvent(event:MouseEvent):void{
        if(event.type == MouseEvent.MOUSE_OVER)
            highlight = true;
        else if(event.type == MouseEvent.MOUSE_OUT)
            highlight = false;
    }
   
   
    public function set highlight(value:Boolean):void{
        _highlight = value;
        invalidateDisplayList()
    }
   
     protected override function updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void{
        super.updateDisplayList(unscaledWidth, unscaledHeight);
        graphics.clear();
        graphics.beginFill(0,0);
        graphics.drawRect(0,0,unscaledWidth,unscaledHeight);
        graphics.endFill();         

         name = label;
         bgElement.setActualSize(unscaledWidth, unscaledHeight);
         if(_highlight)
            bgElement.visible = true;
        else
            bgElement.visible = false;
            
               }
       }
}
 

Read the rest of this post»


No Comments »

September 3rd, 2007 by Kyle
Posted in: Flex Charting

I had a customer asking how he could make the lines in a LineSeries have a sensitivity to mouse proximity similar to the datapoints.
Here is what I came up with:

The essence of the solution was to extend the LineRenderer and draw an additional line with alpha=0, but of specified width, to the graphics object that the visible line is drawn on. That way mouse events will be dispatched by this line.

I figured the most logical place to specify the lineSensitivity attribute would be on the “Stroke” object, so I added that property to an extension of the Stroke class that I then access in my custom LineRenderer.

Here is the Stroke extension:

package
{
    import mx.graphics.Stroke;

    public class MyStroke extends Stroke
    {
        public function MyStroke(color:uint=0.0, weight:Number=0.0, alpha:Number=1.0, pixelHinting:Boolean=false, scaleMode:String="normal", caps:String=null, joints:String=null, miterLimit:Number=0.0)
        {
            super(color, weight, alpha, pixelHinting, scaleMode, caps, joints, miterLimit);
        }
       
        private var _lineSensitivity:Number=50;
   
        [Inspectable(category="General")]
   
        public function get lineSensitivity():Number
        {
            return _lineSensitivity;
        }
       
        /**
         *  @private
         */

        public function set lineSensitivity(value:Number):void
        {
            _lineSensitivity = value;
        }      
       
    }
}
 

Read the rest of this post»


No Comments »


Professional Medicines, Online Pharmacy buy clomid buy viagra buy cialis buy tramadol buy soma buy levitra buy propecia buy ultram buy acomplia buy phentermine buy xenical buy kamagra Online Pharmacy Products
cialis consultation delivery discount health man cialis cialis forum cialis side eefects low cost generic generic cialis pills effectiveness viagra levitra cialis cheapest generic viagra and cialis pills cat 6 cialis bargain levitra levitra cialis dysfunction erectile levitra viagra 2003 cyalis levitra market sales viagra clarinex stimula levitra aldara pay pal order diflucan viagra, cialis, levitra, diflucan, clomid buy generic soma dream levitra online order pharmaceutical zithromax price soma prescriber information soma aura soma color therapy essences soma carisoprodol 350mg soma restaurant scottsdale buy pfizer viagra viagra buying online story viagra viagra before and after viagra substituts modo de empleo viagra viagra suppositories side effects viagra testemonials viagra videos