hide side navigation
    5 most recent
    Web Services
    Library's
    Component's
    Applications
  Tree menu  Flex 2 Guestbook  Videobox  Simple mp3 player  Videoroom  Moving menu  Flash db board reader  Simple photo gallery  Simplecart and External Interface  Email in Flash II  Photo and Video gallery  New Store  Flash GuestBook V2  Flash-db Miniboard  ActionScript dictionary  Private chat with FlashCom  Flash Whois  An online store  Flash RSS reader  Net Tools - Whois in Flash  Flash Message Board  Flash GuestBook  Email in Flash  Sending Custom Ecards  Simple Live Counter with PHP
    Articles
Current Page (1) Next Page >>  View Article Example >> 1 | 2 | 3

Where is the code?

The code around this application is in four different places:

- First frame (remoting handlers and additionally help functions)
- Ventana1.details: just a listener to pass selected product to the shopping cart
- Ventana2.cart: all the shopping cart related functions
- Checkout_form (on the library): manage all the check-out process trough the accordion interface. Dynamically replace the content of the scrollPane. Each one of the MC dynamically attached to the accordion have inherent code to manage his own step
- Ventana1 and Ventana2 have additionally code to play around the maximize/minimize window feature, just a funny interaction that I like from the Flex demo store

Remoting handlers

I have used the methodName_Result schema to handle request. This approach imply set the scope to the timeline where the netConnection is instantiated, so forwarding from here any result, doesn't matter where the call was made. Also setting the service in the _global scope helps in calling it from anywhere.

If you want to customize the app for your needs, the shopping class (shopping.php inside the service class) is probably one of the places where you need to look around. Here's an excerpt of one of the most complex methods. The getProducts methods receive a recordset with all the products inside a family and pass to the ScrollPane and details window:

 
getProducts_Result 
= function(rs){
    
//Clean the holder
    
for(i in pane.contentpane.content[i].removeMovieClip()
    
pane.hScrollPolicy "off"
    
cant rs.length
    z 
0
    
//loop trough rows to load inso pane
    
for(var i=0i<canti++){
        
//set Pane content
        
pane.content.attachMovie("holder""holder"+(z++), z, {_y:10+(150*int(z/4)), _x:(120*(z%4))+5})
        
//Textfield showing details
        
p.createTextField("datos"2, -2010512040)
        
p.datos.multiline true
        p
.datos.html true
        
var txt addBreak(rs.getItemAt(i).Name20)
        
p.datos.htmlText "<p align=\"center\">"+txt+"<p>"
        
//exyernal and internal holder where the image will be loaded
        
p.createEmptyMovieClip("foto"+i1)
        
p["foto"+i].createEmptyMovieClip("holder"1)
        
//load the timage
        
p["foto"+i].holder.loadMovie("products/pics/"+rs.getItemAt(i).Image)
        
p["foto"+i].datos rs.getItemAt(i)
        
//set the onPress handler
        
p["foto"+i].onPress = function(){
            var 
target this._parent._parent._parent._parent.ventana1.details
            target
.datos this.datos //Copy data 
            
target.holder.loadMovie("products/photos/"+this.datos.Image)
            
target.title.text this.datos.Name
            target
.details.htmlText "<b>Content:</b> "+this.datos.Content+"<br><b>Weigth:</b> "+this.datos.Weigth+"<br><b>Price:</b> "+this.datos.Price
            target
.cant.value 1
        
}
    }
    
//Default content of the "Details window"
    
ventana1.details.holder.loadMovie("products/photos/"+rs.getItemAt(0).Image);
    
ventana1.details.title.text rs.getItemAt(0).Name
    ventana1
.details.details.htmlText "<b>Content:</b> "+rs.getItemAt(0).Content+"<br><b>Weigth:</b> "+rs.getItemAt(0).Weigth+"<br><b>Price:</b> "+rs.getItemAt(0).Price
    ventana1
.details.datos rs.getItemAt(0)

 

Current Page (1) Next Page >> 1 | 2 | 3