0
votes

i need your help about below purposes.

problem-1:In php we can easily move one page to another and easily use different type of function from those pages.In flex3 how i can use different type of .mxml pages like php. Please guide me with tutorials.It will really helpful for me.

problem-2: In same page some content dynamically updated its resource by done one task.How can i do that please guide me.

2
Can you try rewording or explaining problem 2? I'm having a hard time understanding what you mean. - Jacob
Suppose i have two container where one container contain a image and another one contain(for showing) saved images which retrieved from a folder.So now when i resize image and click the save button the image will saved that folder and dynamically show it in that save images container.please if possible give me tutorials link or full example.Cause i'm new in flex.The given answer is really tough to understand for me.If possible give me tutorials link or full example. - mahedi

2 Answers

1
votes

Rather than treating your Flex application as a series of pages, you may want to consider an all-in-one SWF instead. This greatly reduces navigation time, at the cost of a longer initial download. You can switch among different views using tab pages or view stacks. As far as keeping your functions for each page separate, you can do this by implementing each logical "page" as a separate MXML component. Your top-level application MXML would look something like this:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
    xmlns:my="com.mycompany.myapp"
>
    <mx:ViewStack id="pageViewStack" width="100%" height="100%">
        <my:MyComponent1 width="100%" height="100%"/>
        <my:MyComponent2 width="100%" height="100%"/>
    </mx:ViewStack>
</mx:Application>
1
votes

For your second problem I have 2 files

imageResize.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" viewSourceURL="srcview/index.html">
    <mx:Script>

        <![CDATA[
            import mx.collections.ArrayCollection;
            private var _imageHolderWidth:Number = 500;
            private var _imageHolderHeight:Number = 500;
            [Bindable]
            private var imageArrayCollection:ArrayCollection = new ArrayCollection();

            private function changeSize():void{
                this.imageHolder.width = this._imageHolderWidth *(this.widthSlider.value * 0.01);
                this.imageHolder.height = this.imageHolder.width;

            }

            private function addToTileList():void{

                var bitmapData : BitmapData = new BitmapData(this.imageHolder.width, this.imageHolder.height );
                var m : Matrix = new Matrix();
                bitmapData.draw( this.imageHolder, m );
                this.imageArrayCollection.addItem({bitmapData: bitmapData, width: this.imageHolder.width, height: this.imageHolder.height});
            }

        ]]>
    </mx:Script>

    <mx:Image id="imageHolder" source="@Embed('fx.png')" />

    <mx:HSlider id="widthSlider" width="400" y="520" maximum="100" value="100" minimum="1" labels="[1%, 50%, 100%]" snapInterval="1" change="{changeSize();}" liveDragging="true" />
    <mx:Button label="add to tile" click="{this.addToTileList();}"/>
    <mx:TileList x="520" dataProvider="{this.imageArrayCollection}" itemRenderer="TileListRenderer" />
</mx:Application>

second file TileListRenderer.mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100" height="140">
    <mx:Script>
        <![CDATA[
            import mx.utils.ObjectUtil;
            override public function set data(value:Object):void
            {
                super.data = value; 
            }
        ]]>
    </mx:Script>
    <mx:VBox horizontalAlign="center">
        <mx:Image id="thumbHolder" source="{new Bitmap(data.bitmapData)}" maxWidth="100" maxHeight="100" />
        <mx:Label text="{data.width}x{data.height}" />
    </mx:VBox>


</mx:Canvas>

Because it is easier to see it with working source (right mouse button to see the source):

blog.arnomanders.nl/upload/imageResize/imageResize.html