HorizontalCenter and verticalCenter

Hi all, how do I get the horizontalCenter and verticalCenter
values of a container after I drag and drop the component in the
container?
Any help is very much appreciated. Thanks.

I posted the example earlier in this thread.
The problem is the objects don't stay in one place or stay one size.  They change sides and resize.  Sticking them in groups seems to limit the ability to smoothly transition them to new positions and sizes.
Picture two objects, one left side and one right.  The objects always need to be centered in their side, even as they change size or *switch* sides.  They also need to automatically use all available space on their side while maintaining an aspect ratio (like 4:3, 16:9, etc).  So if the user resizes the browser, aspect ratios must be maintained as the items resize.
You as the user have the option to do the following:
1.  Have the objects switch sides (reverse)
2.  Have the objects resize (left side gets big and right gets small, or the opposite, or have the two size equally)
3.  Have one object disappear and the other take over full screen
4.  Have the other object disappear and the first one take over full screen
These movements are animated with easing transitions.  Centering them within a column is as simple as changing the horizontalCenter position with respect to the column.  How would you do that with groups? 

Similar Messages

  • Changing the horizontalCenter and verticalCenter of image

    I have a Image that is vertically and horizontally centered.  I have a button that makes the image rotate on it center point when it is hit.  when I drag and drop the image and hit the buttton again the point stays in the same place so the image rotates wide.  Is there a way to move the horizontalCenter and verticalCenter when I drag and drop the image?

    This is no easy task!
    The simpler of these two request would be the brightness.
    To make a color brighter would involve shifting the color value in RGB space toward white (255,255,255). This shift in color values can not be a fixed amout for all three components (RGB) but should be scaled based on the original color and its distance in color space from white.
    I believe brightness will be the easier part because it involves only comparing a single pixel color with white and adjusting.
    Contrast is more complicated because it will involve shitfting some of the colors toward white and others toward black.
    So...
    The image Toolkit just may be worth it cost!
    Ig you write this yourself, please share what you find. The world of images and color are both s
    ubjects that interest me.
    Trying to help,
    Ben
    Ben Rayner
    Certified LabVIEW Developer
    www.DSAutomation.com
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • HorizontalCenter and X position

    hello
    i have given the horizontalcenter and verticalcenter 0,0 to
    a image for proper working of zooming image.
    but i am facing difficulties in rotation and antirotation it
    is not taking originX and originY
    here is the cide

    Check out the next_navigation_item option for the get_item_property procedure. If you use this you can do the process without having to navigate from one item to the next.
    You can do something like this (untested) to move and resize the items (other than the first in the block):
    PROCEDURE move_and_resize(p_item IN ITEM, p_width IN PLS_INTEGER) IS
      prev_item ITEM := Get_Item_Property(p_item, PREVIOUS_NAVIGATION_ITEM);
    BEGIN
      Set_Item_Property(p_item, WIDTH, Get_Item_Property(p_item, WIDTH) + p_width);
      Set_Item_Property(p_item, X_POS, Get_Item_Property(prev_item, WIDTH) +
                                       Get_Item_Property(prev_item, X_POS));
    END move_and_resize;
    move_and_resize(myitem, -30);

  • Center things in Spark ConstraintColumns?

    I have a Flex 3.5 app that I'm trying to upgrade to 4.5 and Spark.
    The app splits the width of your screen into two columns and centers objects on each side, one in the left half and one in the right.  I'm at a loss as to how to duplicate this functionality using Spark components.  Here's a basic example of the old 3.5 code that works fine.  It basically creates two columns and horizontally and vertically centers items within them:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   backgroundColor="blue">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <mx:Canvas id="mainContentArea"
                 top="100" bottom="100"
                 width="100%"
                 backgroundColor="red">
            <mx:constraintColumns>
                <s:ConstraintColumn id="col1" width="{width/2}" />
                <s:ConstraintColumn id="col2" width="{width/2}" />
            </mx:constraintColumns>
            <mx:Canvas id="greenContainer"
                               backgroundColor="green"
                               width="400" height="300"
                               horizontalCenter="col1:0"
                               verticalCenter="0">
            </mx:Canvas>
            <mx:Canvas id="yellowContainer"
                       backgroundColor="yellow"
                       width="200" height="150"
                       horizontalCenter="col2:0"
                       verticalCenter="0">
            </mx:Canvas>
        </mx:Canvas>
    </s:Application>
    I took a shot using Spark components.  The only container layout that seems to allow ConstraintColumns seems to be ConstraintLayout.  Ironically though it doesn't allow you to horizontally center within those columns (horizontalCenter and verticalCenter only good in Basic and Absolute layouts).  Any suggestions on making this happen?
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   backgroundColor="blue">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <s:SkinnableContainer id="mainContentArea"
                 top="100" bottom="100"
                 backgroundColor="red">
            <s:layout>
                <s:ConstraintLayout>
                    <s:constraintColumns>
                        <s:ConstraintColumn id="col1" width="{width/2}" />
                        <s:ConstraintColumn id="col2" width="{width/2}" />               
                    </s:constraintColumns>                   
                </s:ConstraintLayout>
            </s:layout>
            <s:BorderContainer id="greenContainer"
                               backgroundColor="green"
                               width="400" height="300"
                               horizontalCenter="col1:0"
                               verticalCenter="0">
            </s:BorderContainer>   
            <s:BorderContainer id="yellowContainer"
                               backgroundColor="yellow"
                               width="200" height="150"
                               horizontalCenter="col2:0"
                               verticalCenter="0">
            </s:BorderContainer>       
        </s:SkinnableContainer>
    </s:Application>

    I posted the example earlier in this thread.
    The problem is the objects don't stay in one place or stay one size.  They change sides and resize.  Sticking them in groups seems to limit the ability to smoothly transition them to new positions and sizes.
    Picture two objects, one left side and one right.  The objects always need to be centered in their side, even as they change size or *switch* sides.  They also need to automatically use all available space on their side while maintaining an aspect ratio (like 4:3, 16:9, etc).  So if the user resizes the browser, aspect ratios must be maintained as the items resize.
    You as the user have the option to do the following:
    1.  Have the objects switch sides (reverse)
    2.  Have the objects resize (left side gets big and right gets small, or the opposite, or have the two size equally)
    3.  Have one object disappear and the other take over full screen
    4.  Have the other object disappear and the first one take over full screen
    These movements are animated with easing transitions.  Centering them within a column is as simple as changing the horizontalCenter position with respect to the column.  How would you do that with groups? 

  • Centering Custom Preloader

    Does anyone know how to center a custom preloader I don't
    know how to find the broswer width & height in my custom
    preloader class file.
    Thanks for your help

    Thanks for your reply.
    I tried couple of different ways to set both horizontalCenter
    and verticalCenter = 0 but, I was not able to get this to work.
    I'm using this example to create a preloader...
    http://livedocs.adobe.com/flex/201/html/app_container_064_19.html
    add in my main mxml file ....
    preloader="CUSTOM.PreloaderClass"
    Thanks for your help.

  • Performance building Tile Flex 3 and List Flex 4

    Hi,
    I'm writing aplication in FlashBuilder, I see that building Tile with repeaters(Flex 3) is 3-4 time faster that FB
    and I don't know what I do wrong,
    it is My Code in Flex 3
    <mx:Tile>
                    <mx:Repeater id="dayRepeater" dataProvider="{ arr }" >
                        <mx:Canvas width="78" height="38" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
                              <calendar:CalRenderer dataProvider = "{ dayRepeater.currentItem as DataVO }"/>
                        </mx:Canvas>
                    </mx:Repeater>
                </mx:Tile>
    and inside repeater is following code
    <mx:Canvas>
            <mx:Image x="0" y="0" width="78" height="38" source="{ dataProvider.renBackUrl}" scaleContent="true" maintainAspectRatio="false" verticalAlign="middle" horizontalAlign="center"/>
        </mx:Canvas>
        <mx:Canvas x="{dataProvider.imgIcoX}" y="{dataProvider.imgIcoY}" width="24" height="26">
            <mx:Image width="20" height="20" source="{ dataProvider.holyico}" horizontalCenter="0" verticalCenter="0" verticalAlign="middle" horizontalAlign="center"/>
        </mx:Canvas>
        <mx:Text id="renTxt" styleName="{dataProvider.txtIdFont}" x="{dataProvider.txtIdX}" y="{dataProvider.txtIdY}" text="{dataProvider.id}" width="51.5" height="34.149994" fontSize="22"  textAlign="right"  fontWeight="normal" color="{dataProvider.renMainTxtColor}" selectable="false"/>
        <mx:Text styleName="{dataProvider.txtNameFont}" x="{dataProvider.txtNameX}" y="{dataProvider.txtNameY}" text="{dataProvider.names}" width="100%" height="10.799999" fontSize="6" textAlign="right" color="{dataProvider.renMainTxtColor}" selectable="false"/>
        <mx:TextArea styleName="{dataProvider.txtHolyFont}" x="{dataProvider.txtHolyX}" y="{dataProvider.txtHolyY}" width="80" height="13.099998" text="{dataProvider.holy}" fontSize="7"  borderStyle="none" backgroundAlpha="0.0" editable="false" cornerRadius="0" color="{dataProvider.renMainTxtColor}" textAlign="right" selectable="false"/>
    In the FB4 the code looks like this
    <s:List id="myList" height="100%" width="100%" x="17" y="30"
                   dataProvider="{arr}"
                itemRenderer="gui.views.ProjectView.CalItemRenderer" >
            <s:layout>
                <s:TileLayout/>
            </s:layout>
        </s:List>
    and renderer look.
        <mx:Canvas>
            <mx:Image x="0" y="0" width="78" height="38" source="{ dataProvider.renBackUrl}" scaleContent="true" maintainAspectRatio="false" verticalAlign="middle" horizontalAlign="center"/>
        </mx:Canvas>
        <mx:Canvas x="{data.imgIcoX}" y="{data.imgIcoY}" width="24" height="26">
            <mx:Image width="20" height="20" source="{ data.holyico}" horizontalCenter="0" verticalCenter="0" verticalAlign="middle" horizontalAlign="center"/>
        </mx:Canvas>
        <!--<s:Rect width="50" height="50" fill.normal="{fill}" fill.hovered="{overfill}" fill.selected="{fill}" bottomLeftRadiusX="5" topRightRadiusX="5" stroke="{borderStroke}"/>-->
        <!--<s:Label text="{data.maskPrvUrl}" color.hovered="0x1313cd" color.selected="0x000000" verticalAlign="bottom"/>-->
        <s:TextArea styleName="{data.txtIdFont}"   x="{data.txtIdX}"   y="{data.txtIdY}"   text="{data.id}"    width="51.5" height="34.149994" fontSize="22" borderVisible="false" borderAlpha="0.0" textAlign="right" color="{data.renMainTxtColor}" fontWeight="normal"  editable="false" selectable="false" contentBackgroundAlpha="0"/>
        <s:TextArea styleName="{data.txtNameFont}" x="{data.txtNameX}" y="{data.txtNameY}" text="{data.names}" width="100%" height="10.799999" fontSize="6"  borderVisible="false" borderAlpha="0.0" textAlign="right" color="{data.renMainTxtColor}" editable="false" selectable="false" contentBackgroundAlpha="0"/>
        <s:TextArea styleName="{data.txtHolyFont}" x="{data.txtHolyX}" y="{data.txtHolyY}" text="{data.holy}"  width="80"   height="13.099998" fontSize="7"  borderVisible="false" borderAlpha="0.0" textAlign="right" color="{data.renMainTxtColor}"  editable="false" selectable="false" contentBackgroundAlpha="0"/>
    arr is ArrayCollection;
    Generaly when I run aplication made witth Flex 3 - Tile is completed after  2-3 sec. In FB4 with SDK10485 - after 6-7 sec.!!!
    Do you have any idea?
    Thx
    Chris

    for info my ArrayCollectio has about 30 indexes
    I found solution.
    I made some test with different text Components (Fx 3 & 4)
    My conclusion is.
    <s:TextArea - create longer that  <mx:TextArea, <s:Label
    I change <s:TextArea to <mx:TextArea  in the ItemRenderer. - now is OK.
    Chris

  • ReferenceError: Error #1069: Property DSPriority not found on String and there is no default value.

    Hi All
                      This is the Error where i got from my sample chatting application...
    ReferenceError: Error #1069: Property DSPriority not found on String and there is no default value.
    at mx.messaging::Producer/handlePriority()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messagi ng\Producer.as:190]
    at mx.messaging::Producer/internalSend()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging \Producer.as:169]
    at mx.messaging::AbstractProducer/send()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging \AbstractProducer.as:561]
    at SampleMessagin/sendMessage()[D:\FlexJavaPrograms\SampleMessagin\src\SampleMessagin.mxml:2 9]
    at SampleMessagin/___SampleMessagin_Button2_click()[D:\FlexJavaPrograms\SampleMessagin\src\S ampleMessagin.mxml:74]
                        this is the code
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
          currentState="{st}"
          creationComplete="consumer.subscribe()">
    <fx:Script>
      <![CDATA[
       import mx.messaging.events.MessageEvent;
       import mx.messaging.messages.AsyncMessage;
       import mx.messaging.messages.IMessage;
       import mx.modules.IModule;
       import mx.states.State;
       [Bindable]
       public var st:String="";
       public function changeStateHandler(event:Event):void
        st = "Login"
       //send message throug this method
       protected function sendMessage():void
        var msg:IMessage = new AsyncMessage();
        msg.headers = uname.text;
        msg.body = sendText.text;
        producer.send(msg);
        sendText.text = " ";
      //message  Handler  
       protected function consumer_messageHandler(event:MessageEvent):void
        // TODO Auto-generated method stub
        var resp:IMessage = event as IMessage;
        dispText.text = resp.headers.toString()+" :: "+resp.body.toString()+"\n";
      ]]>
    </fx:Script>
    <fx:Declarations>
      <s:Producer id="producer"
         destination="chat"/>
      <s:Consumer id="consumer"
         destination="chat"
         message="consumer_messageHandler(event)"/>
      </fx:Declarations>
    <s:states>
      <s:State name="State1"/>
      <s:State name="Login"/>
    </s:states>
    <s:Panel x="246" y="137" width="366" height="200" title="Login Here" includeIn="State1">
      <mx:HBox horizontalCenter="2" verticalCenter="-30">
       <s:Label text="Enter UR Name"/>
       <s:TextInput id="uname"/>
       <s:Button id="login" label="Login" click="changeStateHandler(event)"/>
      </mx:HBox>
    </s:Panel>
    <s:Panel includeIn="Login" x="327" y="78" width="353" height="369"  title="Welcome:{uname.text}">
      <s:TextArea x="6" y="11" height="222" width="335" id="dispText"/>
      <s:TextArea x="10" y="241" height="85" width="258" id="sendText"/>
      <s:Button x="276" y="241" label="Send" height="76" click="sendMessage()"/>
    </s:Panel>
    </s:Application>
    and my messaging-config.xml is as follows
                 <?xml version="1.0" encoding="UTF-8"?>
    <service id="message-service"
        class="flex.messaging.services.MessageService">
        <adapters>
            <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" default="true" />
            <!-- <adapter-definition id="jms" class="flex.messaging.services.messaging.adapters.JMSAdapter"/> -->
        </adapters>
        <default-channels>
            <channel ref="my-polling-amf"/>
        </default-channels>
        <destination id="chat"/>
    </service>
                      can any one help me what is the error present here.............
                         why it is showing error .. am i wrote anything wrong in this code .. please help me....

    I'm not the expert on this topic, but I think this line:
    msg.headers = uname.text;
    ...is throwing the error. Look into how to properly construct the headers for the message. They should be in name/value pairs.

  • Bug : Image Scaling and Centering

    I was wondering if this was a bug with flex or if I was doing something totally wrong.
    The amount of code in this is extremely low, so , I was guessing that there was nothing wrong from my part.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Image id="myimage" maintainAspectRatio="true"
    horizontalCenter="0" verticalCenter="0"
    source="@Embed(source='images.jpg')"
    scaleContent="true" width="100%" height="100%"/>
    </mx:Application>
    This is all the code there is in this application .
    My expectation from this code is that the image should fit the screen, maintain the aspect ratio of the image and finally be both centered horizontally and vertically!
    Can someone help me out in this ?

    Hi,
    Also set verticalAlign="middle" horizontalAlign="center" for the Image control

  • Flex 4 Premium reference to the Stage issue! width and height seem to be switched??

    So I am doing a very basic resize effect with a panel, but if I want it to fill the screen, I have to switch stage.stageWidth and stage.stageHeight. I have also traced them out and they come out as switched values. Anyone else having this issue?
    protected function panel1_addedToStageHandler(event:Event):void
          trace(stage.stageWidth, " " , stage.stageHeight);

    Hi,
    You maybe running into some sort of layout constraint also it depends on how you are initiating the animation, if you are doing it on startup you need to wait for creationComplete to ensure all your dimensions have been calculated for the browser. You shouldn't need to use stage dimensions either. The following code resizes a panel to fill the browser. (note using top/left/bottom/right is a lot smoother than width and height).
    David
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx"
       creationComplete="application1_creationCompleteHandler(event)">
    <fx:Script>
    <![CDATA[
    import mx.events.FlexEvent;
    protected function application1_creationCompleteHandler(event:FlexEvent):void
    pw.valueFrom=pnl.width;
    ph.valueFrom=pnl.height;
    fillscreen.play();
    ]]>
    </fx:Script>
    <fx:Declarations>
    <s:Animate id="fillscreen" target="{pnl}" repeatCount="1" duration="1000">
    <s:SimpleMotionPath id="pw" property="width" valueTo="{width}"/>
    <s:SimpleMotionPath id="ph" property="height" valueTo="{height}"/>
    </s:Animate>
    </fx:Declarations>
    <s:Panel id="pnl" width="250" height="200" horizontalCenter="0" verticalCenter="0">
    </s:Panel>
    </s:Application>

  • [svn:fx-trunk] 10358: Change Application. application so it can return spark Applications and spark WindowedApplications .

    Revision: 10358
    Author:   [email protected]
    Date:     2009-09-17 14:18:43 -0700 (Thu, 17 Sep 2009)
    Log Message:
    Change Application.application so it can return spark Applications and spark WindowedApplications.
    Application.application is still deprecated but this change makes the transition to using Spark Applications easier.
    QE notes: None.
    Doc notes: None.
    Bugs: SDK-21898
    Reviewer: Gordon
    Tests run: checkintests, Application
    Is noteworthy for integration: no.
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-21898
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/core/Application.as

    Try setting the stepSize on the slider to 4. That should reduce the jiggle effect.
    Not sure if it helps, but the following way of placing the graphic in the skin means you don't need to use those binding tags. The group within the graphic will automatically scale. (I use 48 as an arbitrary size for the group. But it will always display relative to the size of the button. You may need to adjust the 30 and 8 values to match your original.)
    <s:Graphic left="1" right="1" top="1" bottom="1"  >
    <s:Group width="48" height="48" >
    <s:Rect  horizontalCenter="0" verticalCenter="0" height="30" width="8">
    <s:stroke>
    <s:SolidColorStroke color="0x000000"/>
    </s:stroke>
    <s:fill>
    <s:SolidColor color="0xff0000"/>
    </s:fill>
    </s:Rect>
    <s:Rect  horizontalCenter="0" verticalCenter="0" height="8" width="30">
    <s:stroke>
    <s:SolidColorStroke color="0x000000"/>
    </s:stroke>
    <s:fill>
    <s:SolidColor color="0xff0000"/>
    </s:fill>
    </s:Rect>
    </s:Group>
    </s:Graphic>

  • Flash mobile development - AIR 3.4 and Microphone access

    I'm encountering an issue with AIR 3.4 and the new Kindle Fire (2nd gen, non-HD).
    There is no microphone, as Amazon's comparison chart illustrates: https://developer.amazon.com/sdk/fire/specifications.html, but AIR is telling me that there is a microphone.
    It also reports a value of TRUE for Camera.isSupported and CameraUI.isSupported.
    So here's the scoop on Kindle Fire:
    1st generation Kindle Fire does not properly support audio capture from within AIR (even with an external Microphone connected). For more information, see: https://bugbase.adobe.com/index.cfm?event=bug&id=3197063
    2nd generation Kindle Fire doesn't support audio capture unless an external microphone is connected. However, I don't know of a way within AIR to differentiate between headphone or no, because Microphone.isSupported always returns TRUE.
    Kindle Fire HD supports audio capture with or without an external mic.
    The best metric I know of to handle this, so far, is to use "android.os.Build.MODEL" to disable microphone use for the 1st gen Kindle.
    This is kind of clunky though.
    It also doesn't allow me to properly handle the 2nd gen Fire because there is no way (that I know of) to determine if the user has a microphone plugged in.
    Anyone from Adobe care to weigh-in? (Or anyone that knows an alternative?)
    Edit: Here's a test project that I've created that illustrates the problem:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" applicationComplete="init()"
                   xmlns:s="library://ns.adobe.com/flex/spark" applicationDPI="160">
        <fx:Script>
            <![CDATA[
                private function init():void {
                    cameraLabel.text = "Camera: " + Camera.isSupported.toString();
                    cameraUILabel.text = "CameraUI: " + CameraUI.isSupported.toString();
                    microphoneLabel.text = "Microphone: " + Microphone.isSupported.toString() + " => " + Microphone.getMicrophone();
            ]]>
        </fx:Script>
        <s:VGroup horizontalCenter="0" verticalCenter="0">
            <s:Label id="cameraLabel" />
            <s:Label id="cameraUILabel" />
            <s:Label id="microphoneLabel" />
        </s:VGroup>
    </s:Application>
    Running this program on a 2nd gen Kindle Fire results in the following values being displayed on the screen:
    Camera: true
    CameraUI: true
    Microphone: true => [object Microphone]

    You can read this from the "/system/build.prop" file on Android.
    Funky Monkey Studio has released a nice utiltiy class for doing this, NativeDeviceInfo.

  • How to connect to and communicate with an SQLite database in AIR/Flex

    Hey guys,
    I recently decided I would try programming a vocabulary-training program in AIR, so I could use it on Linux as well. I got stuck pretty soon. I am trying to connect to a local SQLite database and I obviously fail epically. Posting the source code of the application here:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
       <mx:Script>
          <![CDATA[  
               import flash.filesystem.File;
              import flash.data.*;
             import mx.controls.Alert; 
                      private var dbFile:File;
                   private var conn:SQLConnection;
                   // -- AUTO INIT FUNCTIONS --------------------------------------------------- /
                   private function init():void {
                        // Create a File Reference to the Included DB
                        dbFile = File.applicationDirectory.resolvePath( "../slovniky.db" );
                        // Create SQL Connection
                        conn = new SQLConnection();
                        // Event Listener that will tell us when the DB is opened
                        conn.addEventListener(SQLEvent.OPEN, openSuccess);
                        // Event Listener that will tell us if an error occurs
                        conn.addEventListener(SQLErrorEvent.ERROR, openFailure);
                   // -- EVENT HANDLERS -------------------------------------------------------- /
             private function starter() :void {
                  slovickoEn.enabled = true;
                  nazor.enabled = true;
                  odeslat.enabled = true;
                  zrusit.enabled = true;
                  start.enabled = false;
                  // Otevírám spojení s databází v asynchroním módu
                   conn.openAsync( dbFile );
             private function openSuccess( event:SQLEvent ):void {
                        // Pokud se spojení povede!
                        Alert.show("Spojení se zdařilo!");
               private function openFailure( event:SQLEvent ):void {
                        // Pokud spojení selže!
                        Alert.show("Spojení se nezdařilo!")
             private function kontrola() : void {
                  if (nazor.text != "") {
                       if (nazor.text == "Pes") {
                       Alert.show("Správně!");    
                       else {
                       Alert.show("Špatně!! " + "Napsané slovíčko bylo " + nazor.text);     
          ]]>   
       </mx:Script>
       <mx:VBox width="400" height="200"
                   horizontalCenter="0" verticalCenter="0" backgroundColor="#FFFFFF"
                   paddingBottom="20" paddingLeft="20" paddingRight="20" paddingTop="20"
       >
          <mx:HBox width="100%" verticalAlign="middle" horizontalAlign="center">
             <mx:Label text="Anglicky:"/>
             <mx:TextInput id="slovickoEn" editable="false" text="Dog" enabled="false"/>
          </mx:HBox>
          <mx:HBox width="100%" verticalAlign="middle" horizontalAlign="center">
             <mx:Label text="Česky:"/>
             <mx:TextInput id="nazor"  enter="kontrola()" enabled="false"/>
          </mx:HBox>
          <mx:HBox width="100%" horizontalAlign="center">
             <mx:Spacer width="50" height="10"/>
             <mx:Button id="odeslat" label="Odeslat" color="#0D8401" click="kontrola()" enabled="false"/>
             <mx:Button id="zrusit" label="Zrušit" color="#0D8401" enabled="false"/>
          </mx:HBox>
          <mx:HBox width="100%" horizontalAlign="center">
             <mx:Spacer width="50" height="10"/>
             <mx:Button id="start" label="Start" color="#0D8401" click="starter()" enabled="true"/>
          </mx:HBox>
       </mx:VBox>
    </mx:WindowedApplication>
    The Run of the program tells me this:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
         at pes/starter()[C:\air\projects\pes\src\pes.mxml:45]
         at pes/__start_click()[C:\air\projects\pes\src\pes.mxml:93]
    I would appreciate any help or a how-to. I am an absolute beginner with some experience from HTML, CSS, PHP and rarely JS. What am I doing wrong? File attached for easier manipulation as well.
    Erthy

    Hi,
    Here is the complete example for the same with the code.Let me know if you have any issue with this.
    http://shardulbartwal.wordpress.com/2008/04/14/adobe-air-and-sqlite-connectivity/
    with Regards,
    Shardul Singh Bartwal

  • How to stretch and shrink with browser resize

    Is there a simple way to force stretch and shrink all
    components and text as the browser window resizes? I tried 100%
    width and height in the application tag but that only resizes the
    main container. I want to also resize eveything inside the main
    container and all the subcontainers including all text and all
    graphic objects. With SVG this was simple. I also tried the
    "Resize" effect but again that just resized the container and not
    the elements inside the container. Any suggestions would be greatly
    appreciated. Thanks.

    Each child container is based on it's parent container. So if
    you set a child height and width to 100%, it will stick to the
    height and width constraints of the parent container. In other
    words, you have to set the constraints from the top most parent
    container, down to the bottom container and components. See this
    slight modification of your example below. Setting both panels to
    height/width = 100%, both panels resize accordingly as the window
    is resized.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="onResize();" resize="onResize();">
    <mx:Script>
    <![CDATA[
    [Bindable] public var thisWidth:Number;
    private function onResize():void{
    thisWidth = this.width;
    if (this.width >= 1020){
    pnl1.setStyle("fontSize", 10);
    if (this.width < 1020 && this.width >= 500){
    pnl1.setStyle("fontSize", 8);
    if (this.width < 500){
    pnl1.setStyle("fontSize", 5);
    ]]>
    </mx:Script>
    <mx:Panel title="Panel 1" width="100%" height="100%"
    id="pnl1" fontSize="10">
    <mx:Panel title="Panel 2" width="100%" height="100%">
    <mx:Canvas width="100%" height="100%">
    <mx:Button label="Submit" horizontalCenter="0"
    verticalCenter="0"/>
    <mx:Label text="{thisWidth}" right="10" bottom="10"/>
    </mx:Canvas>
    </mx:Panel>
    </mx:Panel>
    </mx:Application>
    Changing the font size is not as easy. All I can think of is
    setting the font size based on the current size of the window, as
    in my example above.

  • PHP, MSSQL 2000, SERVER 2003 and FLEX 2

    Hi everyone,
    I tried to connect to MSSQL using PHP. I did not get any
    error message but the only problem is when I try to test the
    problem, I get this error message. Everything works fine on my
    local computer "developer", but when I try to program and test on
    my Windows Server 2003, I get this error message:
    ReferenceError: Error #1069: Property loginsuccess not found
    on String and there is no default value.
    at index/::checkLogin()
    at index/__login_user_result()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.rpc.http.mxml::HTTPService/
    http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
    at mx.rpc::AbstractInvoker/
    http://www.adobe.com/2006/flex/mx/internal::resultHandler()
    at mx.rpc::Responder/result()
    at mx.rpc::AsyncRequest/acknowledge()
    at ::DirectHTTPMessageResponder/completeHandler()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    PHP:
    <?php
    $dbhost='localhost';
    $dbuser='sa';
    $dbpass='S@ue0925';
    $mydb='test';
    $dbconn=mssql_connect($dbhost,$dbuser,$dbpass);
    mssql_select_db($mydb, $dbconn);
    $sql = "SELECT id " .
    "FROM tblusers " .
    "WHERE username = '" . $_POST['username'] . "' " .
    " AND password = '" . $_POST['password'] . "' "
    $result = mssql_query($sql, $dbconn);
    $numRows = mssql_num_rows($result);
    //start outputting the XML
    $output = "<loginsuccess>";
    //if the query returned true, the output
    <loginsuccess>yes</loginsuccess> else output
    <loginsuccess>no</loginsuccess>
    if(!$result)
    $output .= "no";
    }else{
    $output .= "yes";
    $output .= "</loginsuccess>";
    //output all the XML
    print ($output);
    ?>
    Can someone please help me?
    Thank you.
    Cliffy

    my code
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:states>
    <mx:State name="Logged In">
    <mx:SetProperty target="{panel1}" name="width"
    value="95%"/>
    <mx:SetProperty target="{panel1}" name="height"
    value="95%"/>
    <mx:RemoveChild target="{password}"/>
    <mx:RemoveChild target="{username}"/>
    <mx:RemoveChild target="{label1}"/>
    <mx:RemoveChild target="{Submit}"/>
    <mx:RemoveChild target="{label2}"/>
    <mx:SetProperty target="{panel1}" name="title"
    value="Members Section"/>
    <mx:AddChild relativeTo="{panel1}"
    position="lastChild">
    <mx:Label x="10" y="10" text="Welcome to the Members
    Section!"/>
    </mx:AddChild>
    <mx:AddChild relativeTo="{panel1}"
    position="lastChild">
    <mx:Label x="10" y="36" text="Here you can do great
    things, like join the forums @ Viper Creations!"/>
    </mx:AddChild>
    <mx:AddChild relativeTo="{panel1}"
    position="lastChild">
    <mx:Label x="10" y="62" text="Label"/>
    </mx:AddChild>
    </mx:State>
    </mx:states>
    <mx:Script>
    <![CDATA[
    import mx.rpc.events.ResultEvent;
    import mx.controls.Alert;
    ]]>
    </mx:Script>
    <mx:Script>
    <![CDATA[
    private function checkLogin(evt:ResultEvent):void
    if(evt.result.loginsuccess == "yes")
    currentState = "Logged In";
    if(evt.result.loginsuccess == "no")
    mx.controls.Alert.show('Invalid username/password');
    ]]>
    </mx:Script>
    <mx:HTTPService id="login_user" result="checkLogin(event)"
    showBusyCursor="true" method="POST" url="
    http://www.phobos-machines.com/login/bin/request.php"
    useProxy="false">
    <mx:request xmlns="">
    <username>
    {username.text}
    </username>
    <password>
    {password.text}
    </password>
    </mx:request>
    </mx:HTTPService>
    <mx:Panel resizeEffect="Resize" width="250" height="200"
    layout="absolute" title="Login System" horizontalCenter="0"
    verticalCenter="-2" id="panel1">
    <mx:Label x="10" y="10" text="Username:" id="label1"/>
    <mx:TextInput x="10" y="36" id="username"/>
    <mx:Label x="10" y="66" text="Password:" id="label2"/>
    <mx:TextInput x="10" y="92" id="password"
    displayAsPassword="true"/>
    <mx:Button x="10" y="122" label="Submit" id="Submit"
    click="login_user.send();"/>
    </mx:Panel>
    <!--registraion -->
    <mx:HTTPService id="login" showBusyCursor="true"
    method="POST" url="
    http://www.phobos-machines.com/login/bin/request.php"
    useProxy="false">
    <mx:request xmlns="">
    <username>
    {username2.text}
    </username>
    <password>
    {password2.text}
    </password>
    </mx:request>
    </mx:HTTPService>
    <mx:Panel x="30" y="10" width="380" height="270"
    layout="absolute">
    <mx:Form x="10" y="19" width="328" height="187">
    <mx:FormItem label="username">
    <mx:TextInput id="username2" width="100%"/>
    </mx:FormItem>
    <mx:FormItem label="Password">
    <mx:TextInput id="password2" width="100%"
    displayAsPassword="true"/>
    </mx:FormItem>
    <mx:FormItem>
    <mx:Button label="Submit"
    click="login.send(),Alert.show('User Registered',
    'Registration',mx.controls.Alert.OK);"/>
    </mx:FormItem>
    </mx:Form>
    <mx:FormHeading x="0" y="0" label="Registration"/>
    </mx:Panel>
    </mx:Application>

  • Problem with spark:resize effect and constraint-layout

    Hi,
    maybe its just a missuderstanding, but how i an get this to work.
    Also move effects doesnt seem to work.
    Does somebody have a Link, where I can get deeeper in constraints and spark.effects?
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                    minWidth="955" minHeight="600"
                    width="100%" height="100%"
                    currentState="State1"
                    initialize="init()">
         <s:layout>
             <s:BasicLayout/>
         </s:layout>
        <fx:Script>
             <![CDATA[
                 import flash.utils.Timer;
                 import flash.events.TimerEvent;
                 import flash.events.Event;
                private var timer:Timer;
                 private function init():void {
                     timer = new Timer(5000);
                     timer.addEventListener(TimerEvent.TIMER, switcher);
                     timer.start();
                 public function switcher(event:TimerEvent):void {
                     if (currentState =="State1") {
                         currentState = "State2";
                     } else  {
                         currentState = "State1";
             ]]>
         </fx:Script>
         <s:states>
             <s:State name="State1"/>
             <s:State name="State2"/>
         </s:states>
         <s:transitions>
             <s:Transition fromState="State1" toState="State2">
                 <s:Resize target="{mainPanel}" />
             </s:Transition>
             <s:Transition fromState="State2" toState="State1">
                 <s:Resize target="{mainPanel}" />
             </s:Transition>
         </s:transitions>
        <s:Panel id="mainPanel"
                 horizontalCenter="0" verticalCenter="0"
                  width.State1="250"  height.State1="200"
                  horizontalCenter.State2="0" verticalCenter.State2="0"
                  left.State2="20" right.State2="20" top.State2="10" bottom.State2="50">
         </s:Panel>
    </s:Application>

    I think there are bugs in this area for transitioning an objects size between states where two different sizing mechanisms are in play.
    If you transition from constraints to constraints or from width/height to width/height it should work better:
        <s:Panel id="mainPanel"
                 horizontalCenter="0" verticalCenter="0"
                 left.State1="200" right.State1="200" top.State1="100" bottom.State1="500"
                 left.State2="20" right.State2="20" top.State2="10" bottom.State2="50">

Maybe you are looking for

  • How to display only one message in WD

    Hi all, I want to display successful message or error message when certain action is perform. I have my message enter in the MessagePool, say Request_Successful_Updated and value is "your request is successfully updated" In my WD, I do this: IWDMessa

  • ITunes crashed and will no longer recognize my iPod Touch!

    My new computer crashed last night while my iPod Touch was in the process of Syncing with my iTunes account.  When it came back up it had to try and recover my iTunes Library. After it did I had to go into my stuff and find all my music and re-add it

  • IPhone 5 Apps won't open after New Years Eve

    I got a new iPhone 5 for Christmas.  Everything was working fine up until New Year's Eve.  On January 1st non of my Apps will open.  I've deleted them manually from the phone and reinstalled them from the App Store, powered phone off, put phone in ai

  • Hi fellas could anybody know how to get back calendar out from trash to original dock below the screen

    Im having problem getting my calendar out from trash(not deleted) to where this belong to dock below the screen accidently click when im using apps cleaner,i try to swipe my application from trash bin to dock station but keep bounce back to bin,i che

  • Date in sql server

    i have below stored proc, execute proc_First@date='03/05/2015',@la=36,@plan='AB' here @la will be always 36. the output is 3 years , 2012-03-01 00:00:00.000 to 2015-03-01. now i want to break this to ,by 1 year. whats changes i need to make here. exa