Welcome, Guest
  • Author Topic: NewStore Tutorial Problem  (Read 3030 times)

    sokoto2300

    • Server what's that
    • *
    • Posts: 1
      • View Profile
    NewStore Tutorial Problem
    « on: 01/31/07, 10:45 »
    Hi guys...Got this serious problem trying to make the Jorge Solis: newstore tutorial work
    Code: [Select]
    #include "NetServices.as"
    #include "NetDebug.as"
    //IMPORTANT -> Change to the proper path
    NetServices.setDefaultGatewayUrl("../newstore/Gateway.php");
    conn = NetServices.createGatewayConnection();
    _global.svc = conn.getService("shopping", this);
    svc.getFamily(); //default method: show promotions
    z=0
    //Hide the loading movie
    sending_lc = new LocalConnection();
    sending_lc.send("lc_name", "dissapear")
    //The combobox is waiting for data
    catList.addItem("Loading ...")
    //disabled interface elements
    enableInterface(false)

    ////////////////////////
    //  Catalog handlers  //
    ////////////////////////
    //Receive current category
    getFamily_Result = function(rs){
    //disable user interaction
    enableInterface(true)
    cant = rs.length
    catList.removeAll()
    //Pass to the combobox
    for(var i=0; i<cant; i++)
    catList.addItem(rs.getItemAt(i).Name, rs.getItemAt(i).PkFamily)
    svc.getProducts(1)
    //Main title
    Title.text = rs.getItemAt(0).Name
    pane.contentPath = "fotos"
    }
    getProducts_Result = function(rs){
    //Clean the holder
    for(i in pane.content) pane.content[i].removeMovieClip()
    pane.hScrollPolicy = "off"
    cant = rs.length
    z = 0
    //loop trough rows to load into pane
    for(var i=0; i<cant; i++){
    //set Pane content
    p = 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, -20, 105, 120, 40)
    p.datos.multiline = true
    p.datos.html = true
    var txt = addBreak(rs.getItemAt(i).Name, 20)
    p.datos.htmlText = "<p align=\"center\">"+txt+"<p>"
    //external and internal holder where the image will be loaded
    p.createEmptyMovieClip("foto"+i, 1)
    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
    }
    //force scrollpane to show scrollBar with the new content
    pane.vScrollPolicy = "on";
    }
    //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)
    }

    //////////////////////////
    //  Check-out handlers  //
    //////////////////////////
    //Info about a client
    getClient_Result = function(rs){
    if(rs.length>0){
    pane.content.fillForm(rs)
    pane.content.ac_comp.login.id = rs.getItemAt(0).PkClient
    } else pane.content.triggerError("Wrong email/pass\n\nTry again")
    }
    //Check that the new client doesn't exists yet
    checkClient_Result = function(cant){
     if(cant<1) pane.content.ac_comp.selectedIndex = 1
     else pane.content.triggerError("This user exists. Please select another user")
    }
    //New client inserted
    insertClient_Result = function(id){
    if(id!="error"){
    pane.content.final.text = "Client inserted\n"
    pane.content.ac_comp.login.id = id
    svc.insertOrder(id, ventana2.cart.getTotal(), pane.content.shipping.text)
    } else pane.content.final.text = "Error inserting client\n"
    }
    //Update existent client
    updateClient_Result= function(id){
    if(id!="error"){
    pane.content.final.text = "Client updated\n"
    svc.insertOrder(id, ventana2.cart.getTotal(), pane.content.shipping.text)
    } else pane.content.final.text = "Error updating client\n"
    }
    //New order
    insertOrder_Result = function(id){
    if(id!="error"){
    pane.content.final.text += "Order inserted\n"
    var details = ventana2.cart.resume()
    svc.insertDetail(id, details);
    } else pane.content.final.text += "Error inserting order\n"
    }
    //Details of the new order
    insertDetail_Result = function(orderId){
    if(orderId!="error"){
    pane.content.final.text += "Details inserted\nDone !"
    ventana2.cart.empty()
    //Send an email to the cutomer
    svc.sendMail(pane.content.ac_comp.login.id, orderId)
    pane.content.ac_comp.unloadMovie()
    pane.content.bye._visible = true
    } else pane.content.final.text +="Error inserting details"
    }
    //Email sended
    sendMail_Result = function(msg){
    //nothing here
    }
    //Listener when the user change category
    catChoice = {}
    catChoice.change = function(evt){
    svc.getProducts(evt.target.selectedItem.data)
    Title.text = evt.target.selectedItem.label
    }
    catList.addEventListener("change", catChoice)

    //adds breaks to text output
    function addBreak(texto, ancho){
    texto += " ";
    var temp = "", first = 0;
    var linea = ancho;
    while(temp.length<texto.length){
    while (texto.charAt(linea)!=" ") linea--;
    temp += texto.substring(first, linea)+"<br>";
    first = linea+1;
    linea += ancho
    }
    return temp;
    }
    //enables/disable buttons on this interface
    function enableInterface(enable){
    ventana1.details.addCat.enabled = enable
    ventana2.details.addCat.enabled = enable
    ventana2.cart.del_but.enabled = enable
    ventana2.cart.check_but.enabled = enable
    ventana1.details.addCart.enabled = enable
    ventana1.details.cant.enabled = enable
    catList.enabled = enable
    }
    //Help function to round to 2 decimals
    _global.round2D = function(nr){
    //How much decimals?
    var tmp = String(nr)
    var pos = tmp.substr(tmp.indexOf(".")+1)
    if(tmp.indexOf(".")==-1) return nr+".00" //no decimals
    else if(pos.length==1) return nr+"0" //1 decimal
    else return Math.round (Number(nr) * 100) / 100 //2 or more
    }
    stop()

    The problem is everytime I try to play the movie in flash it comes up with the error messages:
    Quote
    **Error** Scene=Scene 1, layer=code, frame=1:Line 1: Error opening include file NetServices.as: File not found.
         #include "NetServices.as"

    **Error** Scene=Scene 1, layer=code, frame=1:Line 2: Error opening include file NetDebug.as: File not found.
         #include "NetDebug.as"

    Total ActionScript Errors: 2     Reported Errors: 2


    The movie comes up and nothing happens...no connection to data, nothing...PLEASE SOME HELP...HELP before all my hair falls off...like completely. Thanks
    « Last Edit: 01/31/07, 11:57 by Jorge Solis »

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: NewStore Tutorial Problem
    « Reply #1 on: 01/31/07, 11:58 »
    Use the AS2 version included in the download (flashdb_newstore2.fla)

    Jorge

    DJProject

    • Server what's that
    • *
    • Posts: 1
      • View Profile
    Re: NewStore Tutorial Problem
    « Reply #2 on: 02/24/10, 17:18 »
    Use the AS2 version included in the download (flashdb_newstore2.fla)

    Jorge

    Hi, I use the AS2 version (flashdb_newstore2.fla) and have this errors:

    The class or interface 'mx.remoting.PendingCall' could not be loaded.

    please help

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: NewStore Tutorial Problem
    « Reply #3 on: 02/25/10, 11:27 »
    This use the Remoting library for AS2 that is not included in the last versions of Flash (CS3 and CS4), download from http://www.adobe.com/products/flashremoting/downloads/components/ , use the zip file and unzip in the class tree

    Jorge

    pina33

    • Server what's that
    • *
    • Posts: 2
      • View Profile
      • Email
    Re: NewStore Tutorial Problem
    « Reply #4 on: 06/03/10, 20:14 »
    Hi:

    I'm a newby on this... so try to understand...

    installed AMFPHP v 1.9 (can't see other to download)... installed flash remoting for AS2... tried newstore 2 version (as2)... changed my file gateway.php on c:\wamp\www\ (where all newstore files were unziped) using the url string "http://localhost/flashservices/core/amf/app/Gateway.php" (default url installed by amfphp... also, there's another folders with Gateway.php files inside core folder!!?), changed the as2 code to

    import mx.remoting.Service;
    import mx.services.Log;
    import mx.rpc.RelayResponder;
    import mx.rpc.FaultEvent;
    import mx.rpc.ResultEvent;
    import mx.remoting.PendingCall;
    import mx.remoting.debug.NetDebug;

    //Initialize a Logger
    mx.remoting.debug.NetDebug.initialize(); // initialize the NCD
    var myLogger:Log = new Log( Log.DEBUG, "logger1" );
    // override the default log handler
    myLogger.onLog = function( message:String ):Void {
    // trace( "myLogger-->>>"+message );
    }
    //IMPORTANT -> Change to the proper path
    _global.svc = new Service(   
        "http://localhost/gateway.php",
         myLogger,
         "shopping",
         null,
         null); ....

    also mysql database shopping is running as root and no password... BUT

    still can't get it to work... the only thing I see is "Loading..."

    why?

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: NewStore Tutorial Problem
    « Reply #5 on: 06/03/10, 22:51 »
    Use Charles to findout what happens in communication.

    Further you can use the amfphp browser to find out, if your service is running ok.
    happy flashing
    8)
    Ronald

    pina33

    • Server what's that
    • *
    • Posts: 2
      • View Profile
      • Email
    Re: NewStore Tutorial Problem
    « Reply #6 on: 06/10/10, 20:18 »
    i got this on Charles...

    <br />
    <b>Warning</b>:  include(../amfphp/amf-core/app/Gateway.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in <b>C:\wamp\www\newstore\gateway.php</b> on line <b>3</b><br />
    <br />
    <b>Warning</b>:  include() [<a href='function.include'>function.include</a>]: Failed opening '../amfphp/amf-core/app/Gateway.php' for inclusion (include_path='.;C:\php5\pear') in <b>C:\wamp\www\newstore\gateway.php</b> on line <b>3</b><br />
    <br />
    <b>Fatal error</b>:  Class 'Gateway' not found in <b>C:\wamp\www\newstore\gateway.php</b> on line <b>5</b><br />


    now... what does that mean? should I try changing my server?