Practical knowledge of flex base

2010-02-22  来源:本站原创  分类:Flash  人气:527 

1. Pop-up a new window
Flex class to achieve by PopUpManager new window pops up:
First set up the page to pop-up window, and then in the main window pop-up window out of the first new object, and then can assign the properties pop-up window,

var genggai : GengGaiWindow = new GengGaiWindow();
      genggai.logId = adg.selectedItem.id;
     //  Use the PopUpManager class in the following two methods pop-up window  :
     PopUpManager.addPopUp(genggai,this);
      PopUpManager.centerPopUp(genggai);
      // Use the PopUpManager class has the following method to close the pop-up window  :PopUpManager.removePopUp(this);

Let the window center is

PopUpManager.centerPopUp(PopUpManager.createPopUp(DisplayObject(Application.application),TitleWindow,true));

2. Page Jump - multi-view switching
Flex applications can be realized according to different needs of users for up to switch between the same view, this process is only one view is displayed on the top floor, stacked in the form of other views to be hidden. This function is achieved with the container had ViewStack. ViewStack include container is a view, switch between views through other components or write ActionScript to achieve.
In this case, <mx:ViewStack> tab view:
<mx:Canvas"View1"> View View1 </ mx: Canvas>
<mx:Canvas"View1"> View View2 </ mx: Canvas>
Switch between views: viewstack1.selectedChild = View2;

3.Flex access the java application server LCDS the Flex application based on the most powerful features is the ability to call directly through LCDS server side java code (by using the Remoting service method):
Use the back-end of the java class in remoting-config.xml configuration file which describes, and then through the Flex configuration file as a remote object called an alias. Configuration file:

<destination>
           <properties>  <source>service.UserService</source>   </properties>
      </destination>

Replaced by the following tag in the page only library calls directly to the remote object:

<mx:RemoteObject"userService" destination=" UserService "/>

RemoteObject class instance declarations while pointing out the remoting-config.xml configuration file in the alias statement of java classes, so that you can call a remote java class has:

userService.login(strname,strpwd);

4.Flex page to receive the return value of java class
Flex can not directly receiving the return value of java class, through the following methods:
First of all, in a statement, while remote java class, call the java class specified in a way, the return value through an ActionScript to handle:

<mx:RemoteObject destination="LogService">
              <mx:method name="getTotalPages" result="getTotelResult(event)"/>
     </mx:RemoteObject>

Next in ActionScript class in java by value received:

private function getTotelResult(evt:ResultEvent):void{
                            totlepage = evt.result as int;          }

The first step in this process can also be placed in ActionScript, the example of an ActionScript:

logService.addEventListener(ResultEvent.RESULT,functionResult);

5. Page list of dynamic real-time display
JAVA in the LIST, ARRAYLIST where corresponds to the FLEX can ArrayCollection to receive. To achieve dynamically display list, the first page of the ArrayCollection dynamic binding category:

[Bindable]
      public var logAC : ArrayCollection = new ArrayCollection();

Next, the realization of the dynamic refresh the list, delete an item when:
Call this.initWindow () to refresh the page;
Add a new log:
Call mmm.initWindow () to refresh the main page, which page type mmm-based object (var mmm: FlexTest;), add in the pop-up window, the main page to add his window mmm Vice property

public function gotoDetail3():void{
             var tianjia : TianJiaWindow = new TianJiaWindow();
             tianjia.mmm = this;
             PopUpManager.addPopUp(tianjia,this);
             PopUpManager.centerPopUp(tianjia);   }

6.Flex hyperlink in the realization of similar
Flex is not a hyperlink, the hyperlink can be achieved in disguise, first define the link's address:

public var u:URLRequest = new URLRequest
("http://localhost:8080/FlexTest/bin/FlexTest.html");

Write a ActionScript, use navigateToURL (u, '_self') method to link to the address above:

private function clickTTSelectResult(event:CloseEvent) :void
      {navigateToURL(u,'_self');}

Page link button, call the above ActionScript:

<mx:LinkButton x="508" y="405" label=" Exit  " width="66" height="20" fontSize="11"
click="popTAlert()" />

7. Using FileReference upload files need to be uploaded files are declared as FileReference class.
Open the file browser window with: file.browse (allTypes); attention FileFilter usage, it can not be directly used as
Browse FileReference class member function parameters, to put in the array allTypes. Specific upload code:

var request: URLRequest = new URLRequest
("http://localhost:8080/FlexTest/FileUploadServlet?userid="+userid);
      //request.data = "userid = " + userid;
      file.upload(request);
相关文章
  • Practical knowledge of flex base 2010-02-22

    1. Pop-up a new window Flex class to achieve by PopUpManager new window pops up: First set up the page to pop-up window, and then in the main window pop-up window out of the first new object, and then can assign the properties pop-up window, var geng

  • Some knowledge of Flex summary of garbage collection 2011-05-27

    Some knowledge of Flex garbage collection summary: 1, deleted all references to objects in the external must be removed as a clean garbage collection system in order to be disposed of. 2, the parent child object is outside the internal references to

  • Development of basic knowledge of Flex Module 2010-08-21

    Loading Overview Module loaded in the understanding of this approach, we should first know what Module module. Module is actually a pre-compiled SWF file. Although the SWF file format, but this file can not be run independently, and can only be loade

  • Personal knowledge of Flex 2, job log 2010-12-15

    1, in dataGrid set the style of a particular cell using the following method: override public function set data (value: Object): void { super.data = value; if (value.xxx == yyy) { this.setStyle ("xxx", yyy); } } Just load the DataGrid displays t

  • [Order] sql statement some practical tips for oracle 2010-03-30

    Finishing a book read long ago, and forgot what this was, now contributed. 1) In the select statement, use conditional logic 1select ename, sal, 2 case when sal <= 2000 then 'UNDERPAID' 3 when sal> = 4000 then 'OVERPAID' 4 else 'OK' 5 end as status

  • Flex Flex layout based Learning Manual 2010-10-29

    We focus on this paper and learn about some basic knowledge of Flex layout for Flex beginners, after the Hello World, Flex layout that is next to the essence of learning. Flex layout of the foundation This section only for Flex beginners, there are s

  • Flex and JavaScript interoperability 2009-03-08

    Flex and JavaScript interoperability Flex generated swf file will eventually be deployed to ActiveX pages (html, jsp, asp, aspx, etc.), because ActiveX is an independent body it can not directly access the page element data, same asp, aspx, etc. Serv

  • Flex development 2009-08-19

    http://www.ibm.com/developerworks/cn/web/wa-lo-flexdev/ Introduction to Flex development Document options Print this page Send as an e-mail this page Level: Junior Liu ( [email protected] ), A software engineer, IBM Software Development Center January

  • Flex works by combining a small Google Map 2010-02-25

    In December last year, when asked by friends to do a Google Map based on the MIS system, although the later did not deliver but I also learn from the process a lot. Example, knowledge of Flex, Google Map application after some experiences are private

  • Flex garbage collection and performance optimization of a number of summary 2010-08-28

    Some knowledge of Flex garbage collection summary: 1, deleted all references to objects in the external must be removed as a clean garbage collection system can be disposed of. 2, the child within the parent object is an external reference other obje

  • Flex development process on the understanding of the interface switch 2010-09-29

    1. You can use the interface to switch PopUpManager 2. Use of state (state), since the definition of some state events (StateEvent), in index.mxml (mx: application) in monitoring the status of distributed components of event type, by changing the sta

  • 30 Minutes Flex Test-Drive for Java Developers 2011-07-29

    By Christophe Coenraets Last update: September 6th, 2006 UPDATE (1/12/2007): I put together a Tomcat-based Test Drive Server that includes these out-of-Samples running the Box. Read this POST for more info. The objective of this test-drive is to give

  • Niu Zhuang database learning "curve" 2010-03-20

    Editor's Note: Niu Zhuang, database maintenance, optimization and architecture experts; has received the highest honor in the field of domestic databases - "2006 China's first Distinguished database engineer"; a few years ago, IBM Global Softwar

  • google reader to what I brought 2010-09-17

    Inscription: This article is my heart-felt sentiments, it is addressed to a special friend, hope google reader (hereinafter referred to as GR) gives me the same thing can be passed to you, pass to everyone. Citation: Do not remember the first time sh

  • My first book of the C + + (C + + world travel map) 2011-05-27

    C + + to explore the world tourist map has no shortage of interesting C + + practical grasp the operating principles of the world to learn C + + world "residents" way of thinking free shuttle to the real world and C + + world "My first book

  • "Free read good books": <software engineering to achieve the full modeling> (new) 2010-10-29

    Huazhang company held "free reading of books" campaign, active time: now - November 19 The form: 1) The activities of free book chapters 1 and 2, in http://topic.csdn.net/u/20101029/14/21904977-8468-482b-8872-41c6e3e250f1.html?95180 directly to

  • Adobe AIR Developer Toolbox: Resources and Guide 2009-06-30

    AIR recent study found a good article, articles, translation of, and for all to share. Original Address: http://www.smashingmagazine.com/2009/04/07/adobe-air-developers-toolbox-resources-and-tutorials/ Is to generate an electronic version, download a

  • psad, fwknop, and fwsnort and other well-known open source security software developer on the Linux firewall 2009-07-29

    Network attacks are increasingly seems to get the upper hand. Will be heard almost every day there were new attacks against software vulnerabilities, or is there a more effective way to spread spam (inbox, I can attest to that), or is a company or go

  • Everyone says "We are what Microsoft's development (English)" 2009-09-25

    This book-related information: http://turingbooks.javaeye.com/admin/blogs/379933 See details "This book is a good balance between the two aspects of management and technology, related to software modeling, security design, such as defensive programmi

  • PHP developers should be familiar with the concept of the five 2009-10-27

    PHP developers should be familiar with the concept of the five Grammatical structure of the textbook and practical knowledge of program design is different, the real knowledge to the development of the actual gain. Every php developer web application