AS3 to AS2 communication

I have a SWFLoader in my AS3 application and into my AS3 SWFLoader, I load a AS2Shell.
In this AS2 Shell, I load a movie in an empty MovieClip that I created.
Try as I might, I am not able get the movie (thatt is loaded within AS2) to stay within my AS3 SWF Loader width and height. Below in my AS3 SWF Loader definition and my AS2 Shell code. Does someone know how to get this to work. By the way, setting Stage.scaleMode in my AS2 Shell does not seem to fix the problem.
AS3 SWF Loader def:
        <mx:SWFLoader id="swfPlayer"
            right="22" left="22" top="18" bottom="18"
            scaleContent="false" maintainAspectRatio="true"
            horizontalAlign="center" verticalAlign="middle"
            enabled="true">
        </mx:SWFLoader>
===========================================
AS2 code
import mx.utils.Delegate;
function init()
    //Stage.align         = "TL";
    //Stage.scaleMode     = "showAll";
    var LC_IN_NAME:String    = "_JXLFlashProxy_IN";
    var LC_OUT_NAME:String    = "_JXLFlashProxy_OUT";
    // Flex talks to me
    in_lc = new LocalConnection();
    in_lc.playVideo = Delegate.create(this, playVideo);
    in_lc.stopVideoPlayer = Delegate.create(this, stopVideoPlayer);
    in_lc.gotoNextFrame = Delegate.create(this, gotoNextFrame);
    in_lc.gotoPrevFrame = Delegate.create(this, gotoPrevFrame);
    // the underscore prefix gets around domain restrictions
    in_lc.connect(LC_IN_NAME);
    // I talk to Flex
    out_lc = new LocalConnection();
function playVideo(fileName:String):Void
    var __vid:MovieClip;
    var __vidMCL:MovieClipLoader;
    if(__vid == null)
        __vid = createEmptyMovieClip(__vid, 0);
        __vid._lockroot = true;
        __vidMCL = new MovieClipLoader();
        __vidMCL.addListener(this);
        __vidMCL.loadClip(fileName, __vid);
        out_lc.send(LC_OUT_NAME, "onPlayVideoResult", true);
    else
        out_lc.send(LC_OUT_NAME,
                    "onPlayVideoResult",
                    false,
                    "ERROR: Video already playing.");
function gotoNextFrame():Void
    __vid.nextFrame();
function gotoPrevFrame():Void
    __vid.prevFrame();
function onLoadInit():Void
    out_lc.send(LC_OUT_NAME, "onVideoPlayerLoaded");
function stopVideoPlayer():Void
    if(__vid != null)
        //__vid.videoPlayer.stop();
        __vid.removeMovieClip();
        delete __vid;
        out_lc.send(LC_OUT_NAME, "onStopVideoPlayerResult", true);
    else
        out_lc.send(LC_OUT_NAME, "onStopVideoPlayerResult", false, "ERROR: Video player already stopped.");
init();

I'm in the process of documenting a process I developed on
creating a
Flash-wrapper to launch/control/track Captivate and
Presenter-based files.
It's based on the same component I build (and documented)
here:
http://www.connectusers.com/tutorials/2009/02/certificates/index.php
The current article is about creating custom Flash-based
certificates in
Presenter/Captivate. The component will be the same, but I
just realized in
the last day or so, that I'll have to provide an update to
better support
funcitonality required in the Flash shell (but the component
can be used for
both purposes).
Keep an eye out on ConnectUsers.com for more articles and
interesting
tidbits, I will be documenting.
Regards,
Andrew

Similar Messages

  • Migrate existing code of AS3 to AS2 - URLRequest, URLLoader

    Hi,
    I have written code to read an XML file by using URLRequest and URLLoader in ActionScript 3.0. Code is pasted below. This runs well in AS3.  Problem I am facing is because I wrote this in AS3, I am not able to use the DateChooser component in another part of the flash module because it seems like DateChooser component is not supported in AS3. So I want to migrate my below AS3 code back to AS2.
    **** Code in AS3 (I need help in writing equivalent code in AS2) :-
    var xmlText:XML ;
    var xmlReq:URLRequest = new URLRequest("myFile.xml");
    var xmlLoader:URLLoader = new URLLoader();
    xmlLoader.load(xmlReq);
    xmlLoader.addEventListener(Event.COMPLETE,xmlLoaded);
    function xmlLoaded(event:Event):void
        xmlText = new XML(xmlLoader.data);  
        info_txt.htmlText = xmlText.someTag ;
    **** I cannot use the above as is because, when I change the publish settings from AS3 to AS2, I get following errors -
    The class or interface 'URLRequest' could not be loaded.
    The class or interface 'URLLoader' could not be loaded.
    The class or interface 'Event' could not be loaded.
    Same works well in AS3. What should I do to make this work in AS2 or can anyone direct me in writing an equivalent in AS2.
    Please assist.
    Thanks in advance.
    MG

    parsing is done using the xmlnode methods and properties.  how you parse an xml file (in as2) depends on its structure.  but generally, you use firstChild, nextSibling, childNodes and nodeValue in the appropriate sequence to extact data.  the flash help files have sample code.  for tutorials, check google.
    if you're trying to load a cross-domain xml file, you'll have a cross-domain security issue to deal with.

  • How do you convert this code from AS3 to AS2?

    Hi,
    I created some AS3 code that is working perfectly for us.
    However now we need to convert it to AS2 so that it can be Flash
    Player 8 compatible. If it could also be compatible for Flash
    Player 7 that would be ideal but not a requirement.
    Thanks in advance.

    Are you wanting someone to do the conversion for you, or are
    you asking for general tips for doing the conversion yourself?
    i can give you tips:
    have a look at the
    ActionScript
    2.0 Migration page.
    In this you'll find the property conversions eg(going from
    AS3 to AS2). y becomes _y, height becomes _height, scaleX becomes
    _xscale, void becomes Void etc.
    you'll find that events need to be converted, eg.
    particle.addEventListener(Event.ENTER_FRAME,
    animateParticle);
    becomes:
    particle.onEnterFrame=animateParticle;
    the onEnterFrame class doesn't pass an Event parameter to the
    event listener. Instead, the event listener is automatically in the
    scope of the event dispatcher, so instead of 'event.target' you
    will be able to just target 'this'.
    You'll need to use setInterval() instead of the Timer class.
    You'll need to use attachMovie() instead of
    addChild().

  • Change some code from as3 to as2

    Hi, I want to use as2 because it compatible with my website.
    I want to change some code from as3 to as2
    /////////////////////////////image1//////////////////////////////// if(MovieClip(this.parent).imagetxt.text == "a") {     var imgurl:String = "C:/Users/Thái/Desktop/ls/cotton-1.jpg";     var myrequest:URL = new URL(imgurl);     myloader.scaleContent = true;     myloader.load(myrequest); } /////////////////////////////image2//////////////////////////////// else if(MovieClip(this.parent).imagetxt.text == "b") {     var imgurl2:String = "http://aloflash.com/images/upload/3.jpg";     var myrequest2:URLRequest = new URLRequest(imgurl2);     myloader.scaleContent = true;     myloader.load(myrequest2); }thank you for your support.

    use:
    var myloader:MovieClip=this.createEmptyMovieClip("loader_mc",this.getNextHighestDepth());
    if (MovieClip(this._parent).imagetxt.text == "a") {
        var imgurl:String = "C:/Users/Thái/Desktop/ls/cotton-1.jpg";
        myloader.load(imgurl);
    } else if (MovieClip(this._parent).imagetxt.text == "b") {
        var imgurl2:String = "http://aloflash.com/images/upload/3.jpg
        myloader.load(imgurl2);

  • AS2 communication setup

    Hi,
    We are using AS2 adapter to communicate with the customer. In QA system, in order not to send the files to customer, we have stopped the receiver communication channel manually. We have tested our scenarios by checking the payload of the data. (we could have used the file adapter for testing purpose, we did the same in DEV environment).
    All the messages are failed in receiver communication channel with the error "Communication channel is currently stopped".
    If we start the AS2 communication channel, will all the message transfer to our customer? If so, how can I delete those entries, as we don't want to send those data to customer. I have canceled the messages in message monitoring.
    Please help.
    Regards,
    Vasantha

    Got it.. deleted the message in RWB!!!

  • Non-EDI messages via AS2 Communication Channel

    Hi,
    We have many EDI interfaces running via AS2 communication channel provided by Seeburger.
    I was wondering whether AS2 should only be used for EDI message or any other normal XML formats also.
    If AS2 can be used for other formats also, what is the difference then sending the request via AS2  rather than HTTP.
    Since AS2 is using HTTP transport protocol, I could rather use HTTP communication channel itself.
    Let me know the differences please!

    I was wondering whether AS2 should only be used for EDI message or any other normal XML formats also.
    As far as I know, it is not restricted, I used AS2 protocol to transfer flat files in my last project
    If AS2 can be used for other formats also, what is the difference then sending the request via AS2 rather than HTTP.
    AS2 has more features than plain HTTP, like support MDN message, which allow sender to know the status of receipt immediatly.
    AS2 can be used as Aync or Sync.
    It can keep file name which is useful in some integration with financial institutes.
    Receipts of the file can not deny their receipts of the messages (NonRupdiation)
    Since AS2 is using HTTP transport protocol, I could rather use HTTP communication channel itself
    Yes, you could, but you might loss the feature that AS2 protocol provides, and some  trading partner only ask for AS2 protocol for the transmission of the files.
    Regards
    Liang

  • Converting AS3 to AS2

    Does anyone know how to translate this code into AS2? My client can't support AS3.
    var exitTimer:Timer = new Timer(15000, 1);
    exitTimer.addListener(TimerEvent.TIMER, jump);
    function jump(event:TimerEvent):void {
        gotoAndStop("Scene 1")
    exitTimer.start();
    Thank you!

    I put the wrong script in. This is the one I'm trying to convert from AS3 to AS2. Do I still use the setTimeout function or is the getTimer function more appropriate?
    var exitTimer:Timer = new Timer(15000, 1);
    exitTimer.addListener(TimerEvent.TIMER, jump);
    function jump(event:TimerEvent):void {
        navigateToURL(new URLRequest("http://www.url.com"));
    exitTimer.start();

  • Benefits of AS3 over AS2?

    I would like to accomplish some very basic functionality in
    Flash, such
    as, creating buttons that link to other frames, scenes,
    websites,
    documents, turn on sounds, etc.
    I would ideally like to do this using the built in Behaviors,
    however,
    these will only work with AS2.
    1.) Is there any benefit to using AS2 over AS3?
    2.) Is there a date that Adobe has announced where they will
    no longer
    support AS2?
    Thanks.

    nambo1,
    First of all, the real hero is the Flash Player. The Flash
    Player, the features it has, and the environments it runs in and
    how it runs in those environments (particularly the web browser,
    but as kglad pointed, it's very flexible and is used other places
    as well) is what makes it so popular. ActionScript is simply how
    you programatically use the Flash Player. ActionScript is an
    ECMAScript language of which there are others, but it's the Flash
    Player (and what you can do with it) that attracts people.
    The Flash Player has been popular for awhile now. AS3,
    however, is the latest and completely redone language for the Flash
    Player. Because it's new and because there are significant
    differences between AS3 and its predecessor (AS1 and AS2), there is
    some adoption time required. Many people are still using AS2. You
    can google to find out a lot more detail about the
    advantages/disadvantages to AS3 vs AS2, if that's what you're
    really looking for.

  • Likert Scale Quiz AS3 or AS2

    Hi
    I'm a realtively new user of Flash CS3 Pro and am trying to
    figure out how to create a quiz that uses Likert scale questions
    and answers (quiz-taker can choose from 5 answer choices for each
    question/statement, based on their agreement or disagreent with a
    statement, each choice having a different score from 1 to 5 points:
    strongly disagree=1, disagree=2, neither agree nor disgaree=3,
    agree=4 and strongly agree=5).
    The quiz would have 8 questions/statements, each with their 5
    choices and the total score would be the addition of all 8 choices
    in terms of their point values (1-5).
    As a newbie, this is beyond my AS skills, especially using
    the newer AS3, though AS2 is also a significant challenge.
    I would be grateful for any help, especially a sample script
    that I can adapt to the task.
    Kind Regards,
    saratogacoach

    OK so having had a play around it seems that a simple option is:
    Use transparent buttons with a 3px stroke
    Inside and under each transparent button put a green circle
    Group the circles
    Whenever a button is pressed hide the circle group then make the single green circle corresponding to that button visible
    Clear and assign a variable with a value associated to that button
    This seems quite simple. Provided I can capture the variable values using the captivate to google spreedsheet widget it will work for me.

  • Recieve Information from AS2 Communicator to ABAP Stack

    Hi,
    I have a require to recieve the information (data) through EDI process from the AS2 Communicator
    Please suggest is there any way to complete this taks in SAP-ABAP Stack system.
    Thanks & Regards.
    Praveer.

    Hello Deepu,
    Thanks for all the help thus far, I am already much better off!
    When i go to RSRT and select a query, then I click the "Java Web" button, the link that is launched on the web in the JAVA runtime is:
    http://madbid01.pacific-cycle.com:50000/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex?QUERY=XNAB_BW35DEF_PRESENTATION
    Our patch levels are as follows:
    BW: Release 700, Patch level 0021
    Portal: Release 7.00 Patch level 19
    The results from note 937697 was all green, with 2 exceptions (noted below):
    1. RED - URL's Prefixes Customized on Both J2EE and ABAP Side
    CHECK MESSAGE: The URL for ABAP customizing table RSPOR_T_PORTAL http://madbid01.pacific-cycle.com:50000 is not compatible with the URL for Portal System landscape Web Application Server configuration: http://madbid01.Pacific-Cycle.com:8100
    2. RED - WebAS ABAP Settings
    CHECK MESSAGE 1: Support Desk was not able to read the properties of RFC Destination 'BID_MADBID01_BID'
    CHECK MESSAGE 2: Error when calling function module CONVERT_RFCDES_TO_RFCDISPLAY
    Thanks!
    Nick

  • AS3 to AS2 code

    Hello,  I have a problem with a small code.
    I'm doing a photo gallery in as3 to insert into my website, the problem is that my site is made in as2 and when I insert the gallery into website the up and down buttons don´t work. Someone could tell me how to modify this code ? I need the code in AS2. Thanks
    stop ();
    var arriba = Boolean;
    var abajo = Boolean;
    //scroll
    abajobtn.addEventListener (MouseEvent.MOUSE_DOWN, mover_abajo);
    function mover_abajo (event:MouseEvent) :void {
      abajo = true;
    arribabtn.addEventListener (MouseEvent.MOUSE_DOWN, mover_arriba);
    function mover_arriba (event:MouseEvent) :void {
      arriba = true;
    addEventListener (Event.ENTER_FRAME, mover);
    function mover (event:Event) :void {
      if (abajo == true) {
      if (tiravip.y >= -965) {
      tiravip.y -= 12;
      if (arriba == true) {
      if (tiravip.y <= 7) {
      tiravip.y += 12;
    abajobtn.addEventListener (MouseEvent.MOUSE_UP, detener_abajo);
    function detener_abajo (event:MouseEvent) :void {
      abajo = false;
    arribabtn.addEventListener (MouseEvent.MOUSE_UP, detener_arriba);
    function detener_arriba (event:MouseEvent) :void {
      arriba = false;

    Ned, thanks for answering.
    I tried with this code and doesn´t work. Do you know why ?
    stop ();
    var arriba = Boolean;
    var abajo = Boolean;
    //scroll
    abajobtn..onMouseDown = mover_abajo;
    function mover_abajo () :void {
      abajo = true;
    arribabtn..onMouseDown = mover_arriba;
    function mover_arriba () :void {
      arriba = true;
    addEventListener (Event.ENTER_FRAME, mover);
    function mover (event:Event) :void {
      if (abajo == true) {
      if (tiravip._y >= -965) {
      tiravip._y -= 12;
      if (arriba == true) {
      if (tiravip._y <= 7) {
      tiravip._y += 12;
    abajobtn..onMouseUp = detener_abajo;
    function detener_abajo () :void {
      abajo = false;
    arribabtn..onMouseUp = detener_arriba;
    function detener_arriba () :void {
      arriba = false;

  • Connection Timeout error in AS2 communication

    Hi Gurus
    I am sending an order file to our vendors via Seeburger AS2 adaptor but I am getting the following error:
    Unable to forward message to JCA adapter. Reason: Fatal exception: com.sap.aii.af.ra.cci.XIRecoverableException: SEEBURGER AS2: java.net.ConnectException: Connection timed out: connect # , SEEBURGER AS2: java.net.ConnectException: Connection timed out: connect #
    I see above error in Communication Channel monitor.
    In message monitor of Seeburger I see the below error which suggests the same.
    Could not deliver as2 message to partner: java.net.ConnectException: Connection timed out: connect # null
    I use HTTP protocol in AS2 adaptor channel
    Any help will be very useful.
    Thanks in advance.
    Sunny

    HiSunny,
    Try to ping the server from your PI and check if the connectivity works fine.Also check if there is any firewall issues.
    open the respective data port dynamically, with FTPS, it might be difficult for the firewall to determine this port, because the control connection is already encrypted at the time the data port is negotiated.
    Check this :http://help.sap.com/saphelp_nwpi711/helpdata/en/14/ef2940cbf2195de10000000a1550b0/frameset.htm
    Thanks & Regards
    Naveen
    Edited by: chichilin on Jul 27, 2011 2:43 PM

  • Seeburger AS2 Communication Channel Error

    Hello,
    when trying to send a test message to the AS2 receiver communication channel I get the following error in communication channel monitoring:
    javax.resource.ResourceException: Fatal exception: javax.resource.ResourceException: ResourceException caused by com.seeburger.xi.api.cci.SeeXIDeliveryException: SEEBURGER AS2: AS2 Adapter failure # Outbound configuration error: Failed to get configuration from DTREQUEST and DATABASE.., SEEBURGER AS2: AS2 Adapter failure # Outbound configuration error: Failed to get configuration from DTREQUEST and DATABASE.., ResourceException caused by com.seeburger.xi.api.cci.SeeXIDeliveryException: SEEBURGER AS2: AS2 Adapter failure # Outbound configuration error: Failed to get configuration from DTREQUEST and DATABASE.., SEEBURGER AS2: AS2 Adapter failure # Outbound configuration error: Failed to get configuration from DTREQUEST and DATABASE..
    Have you ever got a similar error? Seems to be a configuration error of the adapter installation itself rather than a problem with configuration objects or the receiver channel.
    Do you have any idea?

    Hi Florian,
    Please provide info if there is a need for any Sender agreement in case we select "Synchronous" mode for MDN and Handle Received MDn as "NoAction".
    I am also getting the below error for my scenario (IDOC --> XI --> AS2)
    Description: AS2 Adapter failure Outbound configuration error: Failed to get configuration from DTREQUEST and DATABASE.. com.seeburger.as2.AS2Plugin.execute
    Thanks and regards
    Ajay Garg

  • JavaScript alert in AS3 or AS2 to debug the external actionscript file

    Hi,
    Is there any way to debug the external AS file as i dont want to use "trace".
    I have an idea to use the input text field the check the variable/function is working right but this is not enough so is there any process in AS2 or AS3.
    Thanks in advance..

    my mistake ..i have used there dynamic textfiled.
    but i got a easy solution by using
    getURL ("javascript:alert('Testing');");
    but this is not the good solution
    is there any way to import the alert contolls in AS2
    like i have read somewhere
    import mx.controls.Alert;
    Please reply..

  • How Can I convert AS3 in AS2?

    Hi,
    I have following script in AS3 & I want it in AS2... is it possible?
    Pls help.....
    package
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.display.MovieClip;
        import gs.TweenLite;
        public class Accordion extends MovieClip
            var speed:Number = 1;
            public function Accordion()
                tour_mc.addEventListener(MouseEvent.MOUSE_OVER, overHandler, false, 0, true);   
                front_mc.addEventListener(MouseEvent.MOUSE_OVER, overHandler, false, 0, true);
                resta_mc.addEventListener(MouseEvent.MOUSE_OVER, overHandler, false, 0, true);
                inv_mc.addEventListener(MouseEvent.MOUSE_OVER, overHandler, false, 0, true);           
                wd_mc.addEventListener(MouseEvent.MOUSE_OVER, overHandler, false, 0, true);
                fd_mc.addEventListener(MouseEvent.MOUSE_OVER, overHandler, false, 0, true);
            protected function overHandler(event:MouseEvent):void
                if(event.target == tour_mc)
                    TweenLite.to(tour_mc, speed, { x:0, y:0 } );
                    TweenLite.to(front_mc, speed, { x:610, y:0 } );
                    TweenLite.to(resta_mc, speed, { x:640, y:0 } );
                    TweenLite.to(inv_mc, speed, { x:670, y:0 } );
                    TweenLite.to(wd_mc, speed, { x:700, y:0 } );
                    TweenLite.to(fd_mc, speed, { x:730, y:0 } );
                else if(event.target == front_mc)
                    TweenLite.to(tour_mc, speed, { x:0, y:0 } );
                    TweenLite.to(front_mc, speed, { x:30, y:0 } );
                    TweenLite.to(resta_mc, speed, { x:640, y:0 } );
                    TweenLite.to(inv_mc, speed, { x:670, y:0 } );
                    TweenLite.to(wd_mc, speed, { x:700, y:0 } );
                    TweenLite.to(fd_mc, speed, { x:730, y:0 } );
                else if(event.target == resta_mc)
                    TweenLite.to(tour_mc, speed, { x:0, y:0 } );
                    TweenLite.to(front_mc, speed, { x:30, y:0 } );
                    TweenLite.to(resta_mc, speed, { x:60, y:0 } );
                    TweenLite.to(inv_mc, speed, { x:670, y:0 } );
                    TweenLite.to(wd_mc, speed, { x:700, y:0 } );
                    TweenLite.to(fd_mc, speed, { x:730, y:0 } );
                else if(event.target == inv_mc)
                    TweenLite.to(tour_mc, speed, { x:0, y:0 } );
                    TweenLite.to(front_mc, speed, { x:30, y:0 } );
                    TweenLite.to(resta_mc, speed, { x:60, y:0 } );
                    TweenLite.to(inv_mc, speed, { x:90, y:0 } );
                    TweenLite.to(wd_mc, speed, { x:700, y:0 } );
                    TweenLite.to(fd_mc, speed, { x:730, y:0 } );
                else if(event.target == wd_mc)
                    TweenLite.to(tour_mc, speed, { x:0, y:0 } );
                    TweenLite.to(front_mc, speed, { x:30, y:0 } );
                    TweenLite.to(resta_mc, speed, { x:60, y:0 } );
                    TweenLite.to(inv_mc, speed, { x:90, y:0 } );
                    TweenLite.to(wd_mc, speed, { x:120, y:0 } );
                    TweenLite.to(fd_mc, speed, { x:730, y:0 } );
                else if(event.target == fd_mc)
                    TweenLite.to(tour_mc, speed, { x:0, y:0 } );
                    TweenLite.to(front_mc, speed, { x:30, y:0 } );
                    TweenLite.to(resta_mc, speed, { x:60, y:0 } );
                    TweenLite.to(inv_mc, speed, { x:90, y:0 } );
                    TweenLite.to(wd_mc, speed, { x:120, y:0 } );
                    TweenLite.to(fd_mc, speed, { x:150, y:0 } );
    Thanks in advance

    Here is a basic outline of how you could proceed.  I do not include the class nomenclature nor all of the buttons.
    tour_mc.onRollOver = front_mc.onRollOver = overHandler; // add in the rest of the mc's
    function overHandler(){
       if(this == tour_mc){
           trace("do tweens for tour_mc");
       } else if(this == front_mc){
           trace("do tweens for front_mc");
       } // and so on for the rest of the mc's

Maybe you are looking for