Flash Gallery | Flash Templates | Flash Menu | Flash Design | Flash Audio & Video

flash page flip

Actionscript 3.0 video tutorials

+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Flash remoting in AS 3.0 to ASP.NET 2.0 flash.net

  1. #1
    Junior Member Settled In danmo is on a distinguished road
    Join Date
    May 2008
    Posts
    14
    Rep Power
    0

    Question Flash remoting in AS 3.0 to ASP.NET 2.0 flash.net

    flash templates
    Hi, I am new to the forum, so sorry if I'm posting this in the wrong section.

    I am having trouble understanding how to use flash remoting in CS3, using Actionscript 3.0 and trying to remote to an aspx page in ASP.NET 2.0 (using c#)

    How do I go about doing this?

    Has anyone done this before?

    All I can find are AS 2.0 examples that are mainly for php.

    I am trying to use the flash.net classes that are in CS3, but so far am having no luck :(

    Any help and advice would be much appriciated.

    Thanks, Daniel.

  2. #2
    Junior Member Settled In danmo is on a distinguished road
    Join Date
    May 2008
    Posts
    14
    Rep Power
    0

    Re: Flash remoting in AS 3.0 to ASP.NET 2.0 flash.net

    I think it has found my gateway.aspx - but I get this error "NetConnection.Call.BadVersion" Anyone know what It means, or is reffering to?

    Thanks, Dan.

  3. #3
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,609
    Rep Power
    9

    Re: Flash remoting in AS 3.0 to ASP.NET 2.0 flash.net

    Hi,
    I need to see your Actionscript code.

  4. #4
    Junior Member Settled In danmo is on a distinguished road
    Join Date
    May 2008
    Posts
    14
    Rep Power
    0

    Re: Flash remoting in AS 3.0 to ASP.NET 2.0 flash.net

    Hi, thanks for the reply.
    I have 2 classes

    1.
    Code:
    package
    {
        import flash.net.NetConnection;
        import flash.net.ObjectEncoding;
        
        public class RemotingService extends NetConnection
        {
            function RemotingService(url:String)
             {
                  // Is this the right coding?
                  objectEncoding = ObjectEncoding.AMF0;
    
                  // Connect to gateway
                connect(url);
    
             }
         }
    }
    2.

    Code:
    package
    {
        import flash.net.*;
        import flash.display.*;
        import flash.events.*;
        import flash.text.*;
        
        public class RemotingTest extends Sprite
        {
            //private var rs:RemotingService;
            private var nt:NetConnection;
            private var t:TextField = new TextField();
            
            function RemotingTest()
            {
                //just a button on the stage - so i can click it to start the code running
                btnRemote.addEventListener(MouseEvent.CLICK, btnRemote_Click);            
            }
            
            private function btnRemote_Click(event:MouseEvent):void
            {
                init();
                t.text = "test";
                addChild(t);
            }
            // init function
            private function init()
            {
                try
                {
                    nt = new NetConnection();
                    nt.objectEncoding=ObjectEncoding.DEFAULT;
                    
                    //should this be The browser is not supported.... ? cos is embeded in aspx page so should be able to just use gateway.aspx? flash
                    //gives me error if invalid parameter if don't have http:// at front
                    nt.connect("http://gateway.aspx");
                    
                    var responder:Responder = new Responder(onResult, onFault);
                    //just so i can see stuff is happenng
                    var t2:TextField = new TextField();
                    t2.text = "gonna try";
                    t2.x = 50;
                    addChild(t2);
                
                    nt.call("_Default.Test", responder);
                    //just so i can see stuff is happenng
                    var t20:TextField = new TextField();
                    t20.text = "did it call";
                    t20.x =100;
                    addChild(t20);
                }
                catch(e:Error)
                {
                    //never shows anything? but in flash says - 
                    //"Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Call.BadVersion
    //    at RemotingTest/::init()
    //    at RemotingTest/::btnRemote_Click()"
                    trace(e.message);
                    var t3:TextField = new TextField();
                    t3.text = e.message.toString();
                    addChild(t3);
                }
            }
    
            private function onResult(result:Object):void
            {
                //nothing is shown
                var t4:TextField = new TextField();
                t4.text = result.toString();
                t4.x = 150;
                addChild(t4);
                
                trace(result);
            }
            
            private function onFault(fault:Object):void
            {
                //nothing is shown
                var t5:TextField = new TextField();
                t5.text = fault.toString();
                t5.x = 150;
                addChild(t5);
                
                trace(fault);
            }
        }
    }
    in asp.net project - website.
    I have a page called Default2.aspx which contains:

    HTML Code:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="_Default" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>RemotingTest</title>
    <script language="javascript">AC_FL_RunContent = 0;</script>
    <script src="http://www.flepstudio.org/forum/advanced-actionscript-3-0/AC_RunActiveContent.js" language="javascript"></script>
    </head>
    <body bgcolor="#ffffff">
    <!--url's used in the movie-->
    <!--text used in the movie-->
    <!-- saved from url=(0013)about:internet -->
    <script language="javascript">
        if (AC_FL_RunContent == 0) {
            alert("This page requires AC_RunActiveContent.js.");
        } else {
            AC_FL_RunContent(
                'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
                'width', '550',
                'height', '400',
                'src', 'RemotingTest',
                'quality', 'high',
                'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
                'align', 'middle',
                'play', 'true',
                'loop', 'true',
                'scale', 'showall',
                'wmode', 'window',
                'devicefont', 'false',
                'id', 'RemotingTest',
                'bgcolor', '#ffffff',
                'name', 'RemotingTest',
                'menu', 'true',
                'allowFullScreen', 'false',
                'allowScriptAccess','sameDomain',
                'movie', 'RemotingTest',
                'salign', ''
                ); //end AC code
        }
    </script>
    <noscript>
        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="550" height="400" id="RemotingTest" align="middle">
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="allowFullScreen" value="false" />
        <param name="movie" value="RemotingTest.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />    <embed src="http://www.flepstudio.org/forum/advanced-actionscript-3-0/RemotingTest.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="RemotingTest" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
        </object>
    </noscript>
    </body>
    </html>
    And the code behind, just to see if will go into it

    Code:
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
    
        }
    
        public void Test()
        {
    //i have a break point here
            string strTemp = "";
        }
    }
    If the remoting did work, would it hit my break point?
    Am not sure what I need to do in order to get this to work.

    Hope someone can help me with this.

    Thanks a lot, Dan.
    Last edited by Flep; 29-05-08 at 14:40.

  5. #5
    Junior Member Settled In danmo is on a distinguished road
    Join Date
    May 2008
    Posts
    14
    Rep Power
    0

    Re: Flash remoting in AS 3.0 to ASP.NET 2.0 flash.net

    where it says the browser if not supported - it was because I had tried to put http : //localhost

    Thanks, Dan.

  6. #6
    Junior Member Settled In danmo is on a distinguished road
    Join Date
    May 2008
    Posts
    14
    Rep Power
    0

    Re: Flash remoting in AS 3.0 to ASP.NET 2.0 flash.net

    Any ideas? I'm sure I must have got somewhere close to the solution.

    I'm also using vista, if that makes any difference for some reason.

    Thanks, Dan.

  7. #7
    Junior Member Settled In danmo is on a distinguished road
    Join Date
    May 2008
    Posts
    14
    Rep Power
    0

    Re: Flash remoting in AS 3.0 to ASP.NET 2.0 flash.net

    Hi, couldn't see how to edit my post, but I am not using the 1st class anymore, was using it earier on, but just the 2nd one in the post.

    Thanks, Dan.

  8. #8
    Junior Member Settled In danmo is on a distinguished road
    Join Date
    May 2008
    Posts
    14
    Rep Power
    0

    Re: Flash remoting in AS 3.0 to ASP.NET 2.0 flash.net

    ok, by changing the permission, I can now get it to go to any page in my asp site, however it only goes to the page load of that page, and I cannot get it to go to the function I am trying to acess.

    Any ideas? Surely someone on here would know how to do this?

    Thanks, Dan.

  9. #9
    Junior Member Settled In yillb is on a distinguished road
    Join Date
    Apr 2008
    Posts
    1
    Rep Power
    0

    Re: Flash remoting in AS 3.0 to ASP.NET 2.0 flash.net

    I've been trying to figure this out as well. Anybody have any ideas?

  10. #10
    Junior Member Settled In danmo is on a distinguished road
    Join Date
    May 2008
    Posts
    14
    Rep Power
    0

    Re: Flash remoting in AS 3.0 to ASP.NET 2.0 flash.net

    Hi, the solution to this is to put all the aspx pages in the same namespace, this also needs to be updated on the aspx page in the inherits"namespace.class" at the top.

    The use the connection of the gateway, using full address.

    Then, when do call, call to namspace.pageclass
    this will take you to the pageload of that page then you do:
    //i called it flash on the aspx page
    if (flash.Params.count > 0)
    {
    Test(flash);
    }

    you need a function test (or whatever to take in a flashgateway.flash - or whatever it's called)

    function Test(flashgateway.Flash flash)
    {
    do stuff with flash like the params in an array
    Also to send something back to the flash:

    flash.Result = "whatever you want to send back";
    }

    Hope this helps someone!!

    Cheers, Dan.

+ Reply to Thread
Page 1 of 2 1 2 LastLast

LinkBacks (?)


Similar Threads

  1. inserire swf fatto con photo flash maker premium in flash
    By ELLLA in forum Actionscript 3.0 avanzato
    Replies: 0
    Last Post: 26-07-10, 13:53
  2. Replies: 89
    Last Post: 01-05-10, 15:02
  3. Replies: 79
    Last Post: 07-02-10, 08:15
  4. flash remoting with AS 3
    By johnbarrett in forum advanced Actionscript 3.0
    Replies: 0
    Last Post: 24-09-08, 06:18
  5. Flash Player 10, Flash CS4 Diesel
    By Flep in forum Off Topic - Libera la mente
    Replies: 7
    Last Post: 16-05-08, 14:30

Tags for this Thread

Bookmarks

Posting Permissions

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