A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] [MX04] delete btn in datafield

Threaded View

  1. #1
    Member
    Join Date
    Jan 2008
    Posts
    84

    resolved [RESOLVED] [MX04] delete btn in datafield

    I have got a button in a datagrid using cellrendering. but I can't seem to modify it into my datagrid cart. Here is the code want I am doing wrong.
    Any help will be great.

    PHP Code:
    //DELETE BUTTON
    import mx.controls.DataGrid;
    import mx.controls.gridclasses.DataGridColumn;

    // Create DataGrid columns
    var col = new DataGridColumn("TheButton");
    col.headerText "Delete";
    col.width 50;
    col.cellRenderer "ButtonCellRenderer";  // Assign custom cell renderer
    grid_dg.addColumn(col);

    var 
    dp:Array = new Array();
    grid_dg.dataProvider.addItem({TheButton:{label:"x"}});

    //BASKET

    var lvSend:LoadVars = new LoadVars();//do not change
    lvSend.business "chelnov63@hotmail.com"//your paypal email address here 
    lvSend.currency_code "GBP"//the currency you would like to use

    book "bag1";
    purse "purse1"

    //define items, their prices, quantity in basket and there associated movieclips
    var aItem:Array = new Array();
        
    aItem[book] = {price:15quantity:0size:10pic:pic};
        
    aItem[purse] = {price:25quantity:0size:30pic:pic};
        
        
    //-----------------------DO NOT CHANGE UNLESS FAMILIAR WITH ACTIONSCRIPT--------------------//    
        
        
    var totalPrice:Number;

    //define drag and drop functionality
    for (var i in aItem) {
        var 
    currentProduct:String i;
        
    aItem[i].item currentProduct;
        
        
    add1btn.onRelease = function() {
            
    aItem[book].quantity++;
            
    //update datagrid
            
    updateDatagrid();
        }
        
    add2btn.onRelease = function() {
            
    aItem[purse].quantity++;
            
    //update datagrid
            
    updateDatagrid();
        }
    }
    deleteall.onRelease = function() {
        
    aItem[currentProduct].quantity++;
        
    basketInfo.dataProvider.removeAll();
    }
    deleteone.onRelease = function() {
        
    basketInfo.dataProvider.removeItemAt(basketInfo.selectedIndex)
    }

    mcPaypal.onRelease = function():Void{
        
    //send variables to paypal

        //CONSTANTS
        
    lvSend.cmd "_cart";
        
    lvSend.upload "1";
        
        var 
    j:Number 1;
        for (var 
    i in aItem) {
            if(
    aItem[i].quantity 0){
                
    lvSend["item_name_"+j] = aItem[i].item;
                
    lvSend["amount_"+j] = aItem[i].price;
                
    lvSend["quantity_"+j] = aItem[i].quantity;
                
    lvSend["size_"+j] = aItem[i].size;
                
    j++;
                }
                
        }
        
    lvSend.send("https://www.paypal.com/cgi-bin/webscr""_self""POST");
    }


    //--------------------------------------- functions ----------------------------------------------//

    function updateDatagrid():Void{
        
    totalPrice 0;
        var 
    aBasket:Array = new Array();
        for (var 
    i in aItem) {
        if(
    aItem[i].quantity ){
           
    aBasket.push({ProductaItem[i].itemSizeaItem[i].sizeQuantityaItem[i].quantityPriceaItem[i].price aItem[i].quantityPicaItem[i].pic});
           
    totalPrice += aItem[i].quantity aItem[i].price;
        }
    }

        
    grid_dg.dataProvider aBasket;
        
    grid_dg.vScrollPolicy "auto";
        
    tTotal.text totalPrice;

    Last edited by shaunfreeman; 05-23-2008 at 06:06 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center