Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I hard try to create comic book app with flash builder 4.5 but it is not work well . So everybody can give me a simple code to help me learn that .
Thanks you
Posted
Comments
Richard MacCutchan 26-Aug-14 3:24am    
Sorry, this site does not provide code to order. Show the code you have written and the errors you receive and people will try to help you. But be specific, do not just say "it does not work".

1 solution

This is my code .
I using cache images to help me show image faster .
When i use List or Datagroup then cache image method is ok . but i can't handle swipe event to display one image at a time

If I use navigator.pushview(MyAppHomeView) then i can handle swipe event, but i can't using cache image ;

So please give me some solution . Thank you

===========Myapp.MXML file===============

XML
<?xml version="1.0" encoding="utf-8"?>
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                            xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.MyAppHomeView" applicationDPI="240"
                            splashScreenImage="@Embed('Images/Sflash.jpg')" >
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <fx:Script>
        <![CDATA[
            [Bindable]
            public var key:int = 0 ;
            import mx.collections.ArrayCollection;
            [Bindable]
            //images link
            public var content:String= "http://1.bp.blogspot.com/-VHmeWpro-qM/U9jZso2hIbI/AAAAAAAAiNI/Hcb-JYeR18k/s1600/8.jpg;http://4.bp.blogspot.com/-QcpT9HebUIA/U9jZyoBxHgI/AAAAAAAAiNQ/2XgEOjy11d8/s1600/9.jpg;http://2.bp.blogspot.com/-Hyar0cCpAu8/U9jYOIOuG7I/AAAAAAAAiLE/L34L59FTSsw/s1600/10.jpg;http://2.bp.blogspot.com/-eJCkT8E771k/U9jYfyfGdpI/AAAAAAAAiLY/exSiD2GkFYA/s1600/12.jpg";
            [Bindable]
            public var tempAc:ArrayCollection=new ArrayCollection(content.split(";"));

        ]]>
    </fx:Script>
</s:ViewNavigatorApplication>



=======================MyAppHomeView.MXML==============
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
		xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView"
		creationComplete="init()">
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
		<s:ContentCache id="ldr" enableQueueing="true"
						maxActiveRequests="1" maxCacheEntries="2"/>
	</fx:Declarations>
	<fx:Style>
	
		@namespace s "library://ns.adobe.com/flex/spark";
		@namespace mx "library://ns.adobe.com/flex/mx";
		s|Image {
			enableLoadingState: true;
		}
	</fx:Style>
	<fx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			import mx.collections.ArrayList;
			import mx.core.FlexGlobals;
			
			public function init():void
			{
			
				var rand:String = new Date().time.toString()
				var arrcaching:Array = [];
			//caching image 
			//	arrcaching.push({src: FlexGlobals.topLevelApplication.tempAc.getItemAt(FlexGlobals.topLevelApplication.key + 1).toString() + rand, cache:ldr});
			
			myListX.dataProvider = FlexGlobals.topLevelApplication.tempAc;
			}
		]]>
	</fx:Script>

	<s:Label id="abc" text="abc"/>
	
	<s:List id="myListX" width="1142" height="1350"
			dragEnabled="true" dropEnabled="true" dragMoveEnabled="true" >
		<s:layout>
			<s:TileLayout id="myListX_tiles" 
						  requestedRowCount="1"
						  horizontalGap="0"
						  verticalGap="0" horizontalAlign="center" verticalAlign="middle" />
		</s:layout> 
		<s:itemRenderer>
			<fx:Component>
				<s:DataRenderer>
					<s:Image source="{data}" height="60%" width="60%" />
				</s:DataRenderer>
			</fx:Component>
		</s:itemRenderer>
		
	</s:List>
</s:View>
 
Share this answer
 
v5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900