Mock-as3 problem

Hi,
Anyone using Mock-as3?  I am and am having a problem.  In a nutshell I created an interface so I could mock the flash ExternalInterface class.  I'm setting expectations prior to calling methods that invoke a mock object built on this interface.  Here's the test code:
         appState.openWindows.push("window1");
         var args:Array = ["window2"];
         mockExternalInterface.mock.method('available').andReturn(true).anyNumberOfTimes;
         mockExternalInterface.mock.method('call').once.withArgs('closeWindow', args);
//         mockExternalInterface.mock.method('closeWindow').withArgs('closeWindow', "window2").once;
         mockExternalInterface.mock.method('call').withArgs('closeMainWindow').once;
         var event:MenuEvent = new MenuEvent(MenuEvent.ITEM_CLICK);
         event.item = menu.menubarXML.menuitem.(@label == "LogoffAndExit");
         var myMainMenuEvent:MainMenuEvent = new MainMenuEvent(MainMenuEvent.CLICK);
         myMainMenuEvent.menuEvent = event;
         menu.menuHandler(myMainMenuEvent.menuEvent);
The call to mockExternalInterface.available is working.  I get a "No Expectation set" error for "MockExternalInterface.call(closeWindow,window2) From Mock-as3.  I've tried setting the expectation using both the String "window2" and the Array "args".  Note the "call" method signature - I suspect that this might be the core of the problem.
(Mock)ExternalInternalInterface.call(functionName:String, ...args);
Thanks,
Rich

I think I may have figured out the cause of the behavior I described below.  The  following article on the FUnit web site  describes a difference between JUnit and FlexUnit behavior WRT equality  comparisons on arrays.  Here's a short snippet from the  article:
The  intent of ‘assertEquals’ according to xUnit convention is to ensure that the  value of two objects are identical, not that they reference the same object. A second assertion type  ‘assertSame’ exists in JUnit (’areSame’ for NUnit) to ensure that two objects  share the same memory  reference.
This seems to explain what I was seeing so I did a quick test to see if this is what is going on in  mock-as3 as well  I changed my mock implementation to  store a reference to invocations of the ExternalInterface.call()  method:
public var callInvocations:Array =  new Array();
public function call(functionName:String, ...args):*
   callInvocations[callInvocationsCurrentIndex++] =  [functionName, args[0]];
   return null;
I then checked the results, first  using:
assertEquals(mockExternalInterface.callInvocations[0], ["closeWindow", "window2"]);
This failed with a message basically stating that "<closeWindow,window2> doesn't equal  <closeWindow,window2>", the same message I got from  mock-as3.
Then I changed the check to this:
assertEquals(mockExternalInterface.callInvocations[0][0], "closeWindow");
assertEquals(mockExternalInterface.callInvocations[0][1], "window2");
Now the test passes.  Hmmm, seems like this might explain things.  If true, then mock-as3 will never work correctly for functions that contain a "...rest" argument.  Now if I can only figure out how to contact the mock-as3 guys and let them know what I think I've found.
Hope this helps someone.
Cheers,
Rich

Similar Messages

  • AS3 Problems with CuePoints using FLVPlayback in Projector executable

    I have a Flash CS3 project that uses the FLVPlayBack component to play 5 FLV files. Each of the files has between 1 and 15 navigation CuePoints embedded in the video (MOV files encoded using Flash Encoder).
    When I test the app using Ctrl-Enter from the IDE all works fine.
    When I test the published projector EXE on the hard disk all works fine.
    When I burn all the files to CD-ROM and start the projector EXE not all is fine.
    When I click on one of my buttons that will navigate to the desired cuepoint within the FLV, it acts like it is unable to find the cuepoint and thus goes to the end of the FLV file.
    This is very annoying and I can not find anything listed anywhere. I suspect it has something to do with buffering or something because the CD-ROM is slower than the hard drive.
    When playing the video all I am doing is:
    vidPlayer.stop();
    vidPlayer.source = "name of flv file";
    vidPlayer.play();
    When I navigate to the cuepoint I am using the following:
    vidPlayer.seekToNavCuePoint(cueName);
    Need help understanding why this is happening.  Thanks.

    I have an update.
    I re-published the Windows Projector executable, this time using the playWhenEnoughDownloaded method of the FLVPlayBack component.
    This has helped some. If I now choose one of the next 2 cuepoints in relation to where the video is currently playing, the seekToNavCuePoint command will find and play from that cuepoint appropriately.
    But if I choose a cuepoint too far from the point of where the video currently playing, it jumps to the end of the video and fires the COMPLETE event.
    Any additional help or suggestions would be helpful.
    Right now I am possibly thinking of breaking up the two larger videos into small videos and dealing with the transitioning in AS3.
    Thanks.

  • Load and unload as3 problem

    Hello all
    I'm having trouble on a project: I have a main movie that loads other according to theframe. In each frame I put the following code:
    var loader:Loader=new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,f);
    loader.load(new URLRequest("file#.swf"));
    addChild(loader);
    function f(e:Event):void{
    loader.scaleX=0.50;
    loader.scaleY=0.50;
    The problem is that when I load the next movie, an overlay happens. Therefore need to unload the swf that is playing and then load the other. I've tried a lot of stuff (unload /unloadAndStop / removeChild) but does not work. Could someone give a help? Thank you.

    Take the first four lines of your code and just leave them as is in the first frame, loading whatever file you intend to load there. 
    var loader:Loader=new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,f);
    loader.load(new URLRequest("file#.swf"));
    addChild(loader);
    Then in subsequent frames just have the line where you load new content: 
    loader.load(new URLRequest("file##.swf"));

  • Simple Change Parent Timeline AS3 problem

    I am just trying to use actionscript 3.0 (Flash CS4) to change the 'Parent' timeline from a button in the 'Child' timeline
    root/
    parent_mc/
    child_mc (button called btn is there)
    This code is in the child_mc timeline above the button
    btn.addEventListener(MouseEvent.CLICK, changeParentTimeline);
    function changeParentTimeline(event:MouseEvent):void
    this.parent_mc.gotoAndStop(10);
    The above produces this error:
    TypeError: Error #1010: A term is undefined and has no properties.
    at Untitled_fla::child_2/changeParentTimeline()
    Any help would be much appreciated.
    Kind regards
    Richard

    Try:
    btn.addEventListener(MouseEvent.CLICK, changeParentTimeline);
    function changeParentTimeline(event:MouseEvent):void
         MovieClip(this.parent).gotoAndStop(10);

  • XML AS3 Problem

    I'm developing an elearning course for learning MS EXCEL.
    In the course, I have Next and Back Buttons to navigate between lessons.
    Each lesson has number of tasks (maximum of 3), which are buttons at the left side.
    and here is part of the XML file:
    <excel>
         <chapter id="1" title="">
         <screen title="lesson">
         <swf>EXCEL/CH01/CH01_S01.swf</swf>
         <ltitle>Chapter 1</ltitle>
         <rtitle>Setting Up a Workbook</rtitle>
         <prompt>Choose a lesson</prompt>
         </screen>
         <screen title="lesson" tasks="3">
         <swf>EXCEL/CH01/CH01_S02.swf</swf>
         <ltitle>Chapter 1</ltitle>
         <rtitle>Setting Up a Workbook</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson01task01">
         <swf>EXCEL/CH01/CH01_S03.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>What's Excel?</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson01task02">
         <swf>EXCEL/CH01/CH01_S04.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>What's Excel?</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson01task03">
         <swf>EXCEL/CH01/CH01_S05.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>What's Excel?</rtitle>
         <prompt>Open the Microsoft Excel</prompt>
         </screen>
         <screen title="lesson" tasks="1">
         <swf>EXCEL/CH01/CH01_S06.swf</swf>
         <ltitle>Chapter 1</ltitle>
         <rtitle>Setting Up a Workbook</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson02task01">
         <swf>EXCEL/CH01/CH01_S07.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Become Familiar with Excel</rtitle>
         <prompt> Roll mouse over each icon to recognize its name</prompt>
         </screen>
         <screen title="lesson" tasks="1">
         <swf>EXCEL/CH01/CH01_S08.swf</swf>
         <ltitle>Chapter 1</ltitle>
         <rtitle>Setting Up a Workbook</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson03task01">
         <swf>EXCEL/CH01/CH01_S09.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Create a workbook</rtitle>
         <prompt> Follow the following Instructions</prompt>
         </screen>
         <screen title="lesson" tasks="1">
         <swf>EXCEL/CH01/CH01_S10.swf</swf>
         <ltitle>Chapter 1</ltitle>
         <rtitle>Setting Up a Workbook</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson04task01">
         <swf>EXCEL/CH01/CH01_S11.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Modify a workbook</rtitle>
         <prompt> Create a new workbook</prompt>
         </screen>
         <screen title="lesson" tasks="1">
         <swf>EXCEL/CH01/CH01_S12.swf</swf>
         <ltitle>Chapter 1</ltitle>
         <rtitle>Setting Up a Workbook</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson05task01">
         <swf>EXCEL/CH01/CH01_S13.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Modify a worksheet</rtitle>
         <prompt> Follow the Instructions</prompt>
         </screen>
         <screen title="lesson" tasks="3">
         <swf>EXCEL/CH01/CH01_S14.swf</swf>
         <ltitle>Chapter 1</ltitle>
         <rtitle>Setting Up a Workbook</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson06task01">
         <swf>EXCEL/CH01/CH01_S15.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Customizing the Excel Window</rtitle>
         <prompt></prompt>
         </screen>
         <screen title="lesson06task02">
         <swf>EXCEL/CH01/CH01_S16.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Customizing the Excel Window</rtitle>
         <prompt>Follow the Instructions</prompt>
         </screen>
         <screen title="lesson06task03">
         <swf>EXCEL/CH01/CH01_S17.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Customizing the Excel Window</rtitle>
         <prompt>Follow the Instructions</prompt>
         </screen>
         <screen title="">
         <swf>EXCEL/CH01/CH01_S18.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Customizing the Excel Window</rtitle>
         <prompt>Follow the Instructions</prompt>
         </screen>
         <screen title="lesson">
         <swf>EXCEL/CH01/CH01_S19.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Test yourself</rtitle>
         <prompt>Follow the Instructions</prompt>
         </screen>
         <screen title="lesson">
         <swf>EXCEL/CH01/CH01_S19.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Test yourself</rtitle>
         <prompt>Follow the Instructions</prompt>
         </screen>              
         </chapter>
         <chapter id="2" title="">
    I load the info and swf files from XML into arrays.
    I'd like when the user click on Next and Back buttons, he navigate only between screens that has title of "lesson".
    and when the screen has attribute of tasks,  tasks buttons appear (number of task buttons is determined by the number in the tasks attribute).
    When the user click on the tasks button, he navigate to screens that comes after the lesson.
    I handled some of them but I can't handle the others.
    Here is the code:
    page.task1.visible = false;
    page.task2.visible = false;
    page.task3.visible = false;
    var excel:XML;
    var len:Number;
    var swfArray:Array=new Array();
    var leftArray:Array = new Array();
    var rightArray:Array = new Array();
    var promptArray:Array = new Array();
    var xmlLoader:URLLoader = new URLLoader();
    var xmlReq:URLRequest = new URLRequest("excel.xml");
    xmlLoader.load(xmlReq);
    xmlLoader.addEventListener(Event.COMPLETE, onXMLLoad);
    var task:Array = new Array(page.task1, page.task2, page.task3);
    function onXMLLoad(e:Event):void
         excel = new XML(xmlLoader.data);
         len = excel.chapter.screen.length();
         //trace(excel.chapter.screen.length());
         for(var i:Number = 0; i < len; i++)
              swfArray.push(excel.chapter.screen.swf[i].text());
              leftArray.push(excel.chapter.screen.ltitle[i].text());
              rightArray.push(excel.chapter.screen.rtitle[i].text());
              promptArray.push(excel.chapter.screen.prompt[i].text());
         page.left_txt.text = leftArray[0];
         page.right_txt.text = rightArray[0];
         page.prompt_txt.text = promptArray[0];
         //trace(leftArray.length);
    //trace(swfArray);
    var swfLoader:Loader = new Loader();
    swfLoader.load(new URLRequest("EXCEL/CH01/CH01_S01.swf"));
    swfLoader.x = 105;
    swfLoader.y = 130;
    page.addChild(swfLoader);
    var n:Number = 0;
    function loadScreen(strURL:String):void
         swfLoader.unload();
         swfLoader.load(new URLRequest(strURL));
         swfLoader.x = 105;
         swfLoader.y = 130;
         page.addChild(swfLoader);
         page.left_txt.text = leftArray[n];
         page.right_txt.text = rightArray[n];
         page.prompt_txt.text = promptArray[n];
         if(excel.chapter.screen[n].@tasks != undefined)
              for(var m:Number = 0; m < excel.chapter.screen[n].@tasks; m++)
                   task[m].visible = true;
                   task[m].addEventListener(MouseEvent.CLICK, onTask_btns);
         else
              for(var t:Number = 0; t < task.length; t++)
                   task[t].visible = false;
    function onTask_btns(e:MouseEvent):void
         if(e.target == task[0])
              loadScreen(swfArray[n+1]);
         else if(e.target == task[1])
              loadScreen(swfArray[n+2]);
         else if(e.target == task[2])
              loadScreen(swfArray[n+3]);
    function onNextButton(e:MouseEvent):void
         if(n < (swfArray.length - 1))
              n += 1;
         else
              n = 0
         loadScreen(swfArray[n]);
    function onPrevButton(e:MouseEvent):void
         if(n > 0)
              n -= 1;
         else
              n = (swfArray.length - 1);
         loadScreen(swfArray[n]);
    page.next_btn.addEventListener(MouseEvent.CLICK, onNextButton);
    page.prev_btn.addEventListener(MouseEvent.CLICK, onPrevButton);
    Waiting for your help.

    I'm developing an elearning course for learning MS EXCEL.
    In the course, I have Next and Back Buttons to navigate between lessons.
    Each lesson has number of tasks (maximum of 3), which are buttons at the left side.
    and here is part of the XML file:
    <excel>
         <chapter id="1" title="">
         <screen title="lesson">
         <swf>EXCEL/CH01/CH01_S01.swf</swf>
         <ltitle>Chapter 1</ltitle>
         <rtitle>Setting Up a Workbook</rtitle>
         <prompt>Choose a lesson</prompt>
         </screen>
         <screen title="lesson" tasks="3">
         <swf>EXCEL/CH01/CH01_S02.swf</swf>
         <ltitle>Chapter 1</ltitle>
         <rtitle>Setting Up a Workbook</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson01task01">
         <swf>EXCEL/CH01/CH01_S03.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>What's Excel?</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson01task02">
         <swf>EXCEL/CH01/CH01_S04.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>What's Excel?</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson01task03">
         <swf>EXCEL/CH01/CH01_S05.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>What's Excel?</rtitle>
         <prompt>Open the Microsoft Excel</prompt>
         </screen>
         <screen title="lesson" tasks="1">
         <swf>EXCEL/CH01/CH01_S06.swf</swf>
         <ltitle>Chapter 1</ltitle>
         <rtitle>Setting Up a Workbook</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson02task01">
         <swf>EXCEL/CH01/CH01_S07.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Become Familiar with Excel</rtitle>
         <prompt> Roll mouse over each icon to recognize its name</prompt>
         </screen>
         <screen title="lesson" tasks="1">
         <swf>EXCEL/CH01/CH01_S08.swf</swf>
         <ltitle>Chapter 1</ltitle>
         <rtitle>Setting Up a Workbook</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson03task01">
         <swf>EXCEL/CH01/CH01_S09.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Create a workbook</rtitle>
         <prompt> Follow the following Instructions</prompt>
         </screen>
         <screen title="lesson" tasks="1">
         <swf>EXCEL/CH01/CH01_S10.swf</swf>
         <ltitle>Chapter 1</ltitle>
         <rtitle>Setting Up a Workbook</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson04task01">
         <swf>EXCEL/CH01/CH01_S11.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Modify a workbook</rtitle>
         <prompt> Create a new workbook</prompt>
         </screen>
         <screen title="lesson" tasks="1">
         <swf>EXCEL/CH01/CH01_S12.swf</swf>
         <ltitle>Chapter 1</ltitle>
         <rtitle>Setting Up a Workbook</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson05task01">
         <swf>EXCEL/CH01/CH01_S13.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Modify a worksheet</rtitle>
         <prompt> Follow the Instructions</prompt>
         </screen>
         <screen title="lesson" tasks="3">
         <swf>EXCEL/CH01/CH01_S14.swf</swf>
         <ltitle>Chapter 1</ltitle>
         <rtitle>Setting Up a Workbook</rtitle>
         <prompt>Click Next to continue</prompt>
         </screen>
         <screen title="lesson06task01">
         <swf>EXCEL/CH01/CH01_S15.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Customizing the Excel Window</rtitle>
         <prompt></prompt>
         </screen>
         <screen title="lesson06task02">
         <swf>EXCEL/CH01/CH01_S16.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Customizing the Excel Window</rtitle>
         <prompt>Follow the Instructions</prompt>
         </screen>
         <screen title="lesson06task03">
         <swf>EXCEL/CH01/CH01_S17.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Customizing the Excel Window</rtitle>
         <prompt>Follow the Instructions</prompt>
         </screen>
         <screen title="">
         <swf>EXCEL/CH01/CH01_S18.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Customizing the Excel Window</rtitle>
         <prompt>Follow the Instructions</prompt>
         </screen>
         <screen title="lesson">
         <swf>EXCEL/CH01/CH01_S19.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Test yourself</rtitle>
         <prompt>Follow the Instructions</prompt>
         </screen>
         <screen title="lesson">
         <swf>EXCEL/CH01/CH01_S19.swf</swf>
         <ltitle>Setting Up a Workbook</ltitle>
         <rtitle>Test yourself</rtitle>
         <prompt>Follow the Instructions</prompt>
         </screen>              
         </chapter>
         <chapter id="2" title="">
    I load the info and swf files from XML into arrays.
    I'd like when the user click on Next and Back buttons, he navigate only between screens that has title of "lesson".
    and when the screen has attribute of tasks,  tasks buttons appear (number of task buttons is determined by the number in the tasks attribute).
    When the user click on the tasks button, he navigate to screens that comes after the lesson.
    I handled some of them but I can't handle the others.
    Here is the code:
    page.task1.visible = false;
    page.task2.visible = false;
    page.task3.visible = false;
    var excel:XML;
    var len:Number;
    var swfArray:Array=new Array();
    var leftArray:Array = new Array();
    var rightArray:Array = new Array();
    var promptArray:Array = new Array();
    var xmlLoader:URLLoader = new URLLoader();
    var xmlReq:URLRequest = new URLRequest("excel.xml");
    xmlLoader.load(xmlReq);
    xmlLoader.addEventListener(Event.COMPLETE, onXMLLoad);
    var task:Array = new Array(page.task1, page.task2, page.task3);
    function onXMLLoad(e:Event):void
         excel = new XML(xmlLoader.data);
         len = excel.chapter.screen.length();
         //trace(excel.chapter.screen.length());
         for(var i:Number = 0; i < len; i++)
              swfArray.push(excel.chapter.screen.swf[i].text());
              leftArray.push(excel.chapter.screen.ltitle[i].text());
              rightArray.push(excel.chapter.screen.rtitle[i].text());
              promptArray.push(excel.chapter.screen.prompt[i].text());
         page.left_txt.text = leftArray[0];
         page.right_txt.text = rightArray[0];
         page.prompt_txt.text = promptArray[0];
         //trace(leftArray.length);
    //trace(swfArray);
    var swfLoader:Loader = new Loader();
    swfLoader.load(new URLRequest("EXCEL/CH01/CH01_S01.swf"));
    swfLoader.x = 105;
    swfLoader.y = 130;
    page.addChild(swfLoader);
    var n:Number = 0;
    function loadScreen(strURL:String):void
         swfLoader.unload();
         swfLoader.load(new URLRequest(strURL));
         swfLoader.x = 105;
         swfLoader.y = 130;
         page.addChild(swfLoader);
         page.left_txt.text = leftArray[n];
         page.right_txt.text = rightArray[n];
         page.prompt_txt.text = promptArray[n];
         if(excel.chapter.screen[n].@tasks != undefined)
              for(var m:Number = 0; m < excel.chapter.screen[n].@tasks; m++)
                   task[m].visible = true;
                   task[m].addEventListener(MouseEvent.CLICK, onTask_btns);
         else
              for(var t:Number = 0; t < task.length; t++)
                   task[t].visible = false;
    function onTask_btns(e:MouseEvent):void
         if(e.target == task[0])
              loadScreen(swfArray[n+1]);
         else if(e.target == task[1])
              loadScreen(swfArray[n+2]);
         else if(e.target == task[2])
              loadScreen(swfArray[n+3]);
    function onNextButton(e:MouseEvent):void
         if(n < (swfArray.length - 1))
              n += 1;
         else
              n = 0
         loadScreen(swfArray[n]);
    function onPrevButton(e:MouseEvent):void
         if(n > 0)
              n -= 1;
         else
              n = (swfArray.length - 1);
         loadScreen(swfArray[n]);
    page.next_btn.addEventListener(MouseEvent.CLICK, onNextButton);
    page.prev_btn.addEventListener(MouseEvent.CLICK, onPrevButton);
    Waiting for your help.

  • Embedding causes authentication request

    Not sure this is an AS3 problem but other Flash files are working.
    Just created my first simple AS3 animation. Trying to embed the file on ASP (through an include file, but that's not the problem), running on IIS6.
    The Flash-suggested nested <object> tags crash the page (HTTP 500 Internal Server Error).
    The older object/embed combination, as well as the Dreamweaver AC_FL_RunContent script, are causing the web server to ask for user authentication:
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  width="190" height="98">
        <param name="movie" value="/academic/upper/math/math_banner.swf" />
        <param name="quality" value="high" />
       <embed src="/academic/upper/math/math_banner.swf" quality="high" width="190" height="98"></embed>
      </object>
    There's an AS2 file running happily on the same page using the Dreamweaver script. The Flash-generated html page works fine, too (http://www.fcds.org/math_banner.html). I've made sure there's an application/x-shockwave-flash MIME type registered on the server. What am I missing?!
    Thanks!

    there's no difference in embedding as2 and as3 files so if you know how to embed an as2 file, use the same code to embed your as3 file.  just make sure the parameters are correct for your as3 swf.

  • Game FPS drops upon playing for 3 hours

    Description :Hi...I am a game programmer and i have made  a game where there is a character which has to select the right pieces and avoid the wrong ones. the pieces/food come from top, the character jumps and fetches them. Thats why we are keeping a gap between the pieces to avoid the character touching the wrong ones. I have made it in AS3
    Problem : When I win the game and keep re-playing it continuously for more than an hour i notice that the gameplay gets slow(slow FPS). The behavior and movement of the characters become slow. Upon playing for 3 hours the slowness is easily noticeable. This also happens when I minimize the game window or get the focus off the game to some other window for a long time (half an hour or more). The problem doesn't come if I play once or if I lose the game and try again. This comes when I keep playing it for a longer time.
    Please suggest if its a programming end issue or a operating system scheduling problem or Flash related bug, and please help in solving it.

    This is probably related to memory usage building up over time due to objects being not destroyed properly. object references and event listeners not removed, loaded SWF not unloaded, XML not destroyed, BitmapData not destroyed, etc all cause the garbage collector to ignore your deleted object. Grant Skinner's old article is good place to start: http://gskinner.com/blog/archives/2006/06/as3_resource_ma.html

  • Problems with a AS3 SWF

    Hello,
    I am having issues with a SWF file posting properly in a Catalyst project.  I have already put a post in the Catalyst section but I wanted to bounce the idea off this room that the issue is more SWF and less Catalyst because everything else in Catalyst is working just fine, including other AS3 SWF files that I have linked throught the site.  The files are here:
    www.electronic-lifestyle.com
    If you enter the Home Theater section you will see a SWF load in the film frame after it downloads (maybe 3 seconds).  This SWF with alter the screen on the image and give you controls on the bottom right corner to shift the aspect ratio of the content on the projection screen.  This is a AS3 SWF that works just fine, but if you click on Electronics the page shifts to another film frame that is blank.  It is a scroll panel in Catalyst that is refusing to load the content which is a SWF with several links set up as buttons in AS3.
    I cannot figure out why one SWF will work and the others will not.  Is it possible that I am publishing the files incorrectly somehow?  I checked the publish settings for the files that work and the files that don't and they are exactly the same.  I have tried to rebuild the pages with both the good SWFs and the bad SWFs and I get the same results.
    Even more puzzling is that the entire project works when I check the Local files.  The issue only rears it's ugle head when I put it on the server and try it live.
    If anyone has insight into the connectiuon between Flash AS3 SWFs and the way FXP files imports them that could come close to explaining this please let me know.  The only difference between the two are the buttons, I am going to try to remove the buttons and see if the SWF works.
    Thanks in advance,
    Brett

    Hey,
    Yes I have figured out the issue and I simply can't believe the solution.  I have been discussing it on the Flash Catalyst Forum.  Here is a recent post, please feel free to take a look at the page I have set up to demonstrate the issue in case you ever come across it.  It is a real kick in the head.
    Brett
    Chris,
    Thanks for  the tip but I just figured out the problem and you are not going believe  this.  I removed the buttons from two of the scroll panes and replaced  them with buttons made in Catalyst and the problem magically went away.   Take a look at this page:
    www.electronic-lifestyle.com/SpeakSEL-OLD/Main.html
    The first three pages work just fine but the Third and Fourth pages (Outdoor & Subwoofer) will not load the SWF.   The ONLY difference between these two pages are the buttons in Flash.   It would seem that buttons will create a destructive error that prevents  the SWF from loading.
    If this pans out then the  developers for Adobe really missed a big one with this.  I have over 47  pages that now need to be rebuilt because I assumed that a button built  in AS3 would not interfere with the SWF load.
    Now this  isn't something that happens all the time, I have several SWFs in this  site that use buttons and work just fine but they are nested in Movie  Clips and they all have to do with timeline controls rather than opening  another URL.  Maybe the "_blank" tag is the issue but I am required to  get the user to a different page by the client's request.  I can't very  well go back to the client and tell him that Catalyst has an issue with  that very normal request.
    Anyway, thanks for the  suggestion, I am spending the rest of my day republishing my SWFs  without buttons just to remake them in FC.  BTW, the real kick in the  head is that the SWFs with the buttons work on the local files, its when  you upload to a server that everyting seems to fall apart.
    Brett

  • AS3 load external swf problem, please help...

    Hey guys, I am really in need of an answer here. I would tremendously grateful if someone has the answer. I'll keep it simple and right to the point:
    1. I have created "index.swf" in AS3. Has it's own "MainClass" class.
    2. I created "holder.swf" which is the main landing page. Has 2 buttons, for the viewer to load the site in fullscreen or standard.
    3. In the timeline of "holder.swf" I have created 2 frames, 1st frame containing the buttons, second frame containing the AS3 external swf loader script.
    It does not seem to want to load my "index.swf".
    I have tested a million different ways, it load other swf's just fine, AS2 and AS3, but for some strange reason it just will NOT load "index.swf".
    This is driving me crazy, I have a feeling it has something to do with a class conflict. I have tried (import MainClass;) in the first frame of "holder.swf" and no luck.
    PLEASE GUYS, LET ME KNOW IF YOU KNOW THE ANSWER!
    THANK YOU SO MUCHO.
    Michael

    Hey kglad,
    Thanks for the quick reply!
    Well here is the problem... With the exception of a few things I need to update, as well as implementing some better preloaders etc... the site is running alright...
    About a week ago I decided that I wanted to site to start with the above landing page. A simple "holder.swf" which would give the viewer something to look at before entering the site... (ideally I want to find a script that will begin loading "index.swf" while the viewer is still on "holder.swf", but I'll figure that out later).
    Anyhow, I created "holder.swf" as I have many times before, and for some reason it does not seem to want to load "index.swf" into the second frame when instructed to do so... does that make sense?
    So... ideally I would like the site to start on the above graphic, then once the button is clicked, "index.swf" opens up...
    It's driving me crazy, because my code works on other swf's I've tested it with, just not with index.swf, which leads me to believe there is something in the MainClass.as file which is causing it not to load...
    What are your thoughts?
    Oh, and many thanks again!!!
    M

  • Load AS2 swf into AS3 swf problem

    I have a flash with AS3 and inside this swf i load in a AS2 swf.
    to load swf works just fine, but the problem is when i load this i want to go to
    a specific part of it, for example i want to go to frame 3 in the loaded swf.
    i must control this from the AS3 swf, does someone know if this is possible?
    thanks in advance

    so can i do like this then to go to frame 3 in my loaded swf?
    MovieClip(ldr.content).gotoAndStop(3); ?
    sorry for being such an airhead
    thanks for helping me out =)
    Date: Sun, 7 Jun 2009 10:25:09 -0600
    From: [email protected]
    To: [email protected]
    Subject: load AS2 swf into AS3 swf problem
    no.
    if, in your loaded swf, you have a function f1() on the loaded swf's main timeline and you load that swf using a loader (say ldr), use:
    MovieClip(ldr.content).f1();   // to call f1() in the loaded swf
    >

  • Is loading a as2 swf into my as3 flash site the problem here?

    My question is listed on another board here, but I am too inexperienced to understand how to fix my issue:
    http://forums.adobe.com/message/5045059#5045059
    I went on flashkit.com and a member there immediately said that it "sounds like the problem is using the AS2 swf loaded into the AS3 swf."
    If it is... this mean I will have to convert everything in the AS2 .swf (including the XML retrieval script) to AS3. I may need some help with that if that is the problem.
    So will AS2 swfs cause XML communication and retrieval issues if loaded with a loader script into an AS3 file?
    Everything works (the buttons are clickable and when you click on a square in the "thumbnails" scroller it displays the correct photo title and captions), except I just cannot see the actual photos in my XML gallery. I am truly clueless as to why this happens and I've searched for days straight and tried many things...
    You'll find all the details of my problem in the above link.
    Thanks!

    Its really not worth the trouble to get as2 working with as3 if your goal is to make an xml driven gallery. There are literally thousands of free examples/tutorials how to achieve that feature with 50+ LOC. Like this one.

  • AS2 swf problem under AS3 swf (probably Tweener problem)

    Hello. I have this problem for a days and it hasn't been soluted yet although I put it on couple of forums. I have 3 files: test.fla, file_as2, file_as3.
    The test.fla file is a typical Loader, which loads external swf files and shows them on the screen. After any key is pressed, the swf is deleted from the screen and loaded again.
    The file_as2 and file_as3 are the AS2 and AS3 compiled having a simple square animation (6 squares fading in from alpha 0 one by one) animated by caurina Tweener. If the file_as3 is compilated and loaded externally there is no problem (six sqares are fading in, after pressing any key the vanish and appear (loaded) again and again...). But if the swf as2 file is loaded, it shows the squares only once and after pressing any key and loading it again, it doesn't shows it at all.
    I guess it's Tweener problem, because when i trace it in AS2 file (onUpdate) it traces only at the beginning.
    How it's possible, that AS3 somehow stops all Tweeners in 2nd time loaded AS2 file?? How to fix it?? Sorry for my english, i left a link for these 3 files to find solution. Try it (test.swf) and then change path inside fla to load AS2 file... Thanks for any ideas.
    Link to download: http://www.filolozka.pl/zip/file.ZIP

    Instead of reusing the same Loader, try loading the AS2 movie multiple times using different Loader instances. Instead of using event listeners like normal, this should be easy to do because you can addChild each Loader instance, and when it is loaded it will automatically play. If you are able to load the AS2 movie multiple times at once and have it work for you, then the problem must be in the way that you removing the old movie, and reusing code to load the movie again.

  • Other problems with loading Captivate files into Flash AS3 project

    I have a Captivate file done with Captivate 3, published to
    Flash player 9 that is being loaded into Flash AS3. The captivate
    is a simple recording of some mouse clicks in a browser. I am
    displaying the playbar along the bottom, and its buttons all work
    fine except for the progress bar, where you can drag the knob and
    scrub back & forth in your presentation.
    This progress bar is not working as it should. I see the
    mouse cursor change to a hand, but when I click I cannot drag the
    knob to control the progress bar. The other buttons in the playbar
    do work (replay, pause, play, back, forward).
    This is a unique problem in that it is only happening when
    viewed in IE (7) when loaded into my Flash AS3 project. When viewed
    in Firefox in my project, or as a standalone SWF, or as a SWF
    simply embedded onto a plain HTML page, it works just fine.
    Does anybody have any insight?
    Another thing I notice with loading Captivate files with AS3
    is the the amount of output messages it displays. Rather annoying
    (unless this is a "feature" I've yet to be aware of - heh)

    Hi,
    I know exactly how you feel, there is simple answer; replace
    Captivate for Camtasia Studio 5 at techsmith.com. The weight on
    those shoulders will be gone! You'll smile more, be more
    socialable. One Happy Person.
    I am very happy person ;)
    Kind Regards,
    Boxing Boom

  • AS3.0 -  Button has a problem ?

    I found a weird problem with the button component. You may
    see the problem on the website right bellow, where you´ll find
    2 programs; (Actually it´s really one program, there´s no
    code at all, I´ve just compiled the same .fla both to ACS 2.0
    and ACS 3.0).
    http://rrgames.sites.uol.com.br/
    The first one, activated by the button labeled "Button AS
    2.0", and compiled with the AS 2.0 publish option set, works
    nicely.
    Now, the second one, activated by the button labeled "Button
    AS 3.0", and compiled with the AS 3.0 publish option enabled, has
    some serious flaws in it:
    Try left-clicking several times inside the main black
    rectangle. You´ll notice that it really doesn´t matter
    where you´re clicking, the red image which denotes the UP
    state keeps partially popping up !
    As for the sound, it gets even messier. On AS 2.0, there are
    2 distinct sounds: One for the OVER state and one for the DOWN
    STATE, and that´s the correct behavior.
    In the AS 3.0 compiled version, when you click the button,
    you´ll get BOTH sounds at the same time.
    Any help would be appreciated,
    Regards,
    RogerUP

    I am quite aware that WHAT I AM DESCRIBING doesn´t make
    a lot of sense. And you´re quite right when you state: "your
    buttons would do nothing except display rollover, rollout press and
    release behaviors. ". And that´s what they should do in a
    coherent fashion, both in AS2.0 and 3.0. And what I´m saying
    is that EVEN those basic 3 states do not behave as expected under
    AS3.0 publishing option. At least the very basic ROLLOVER and PRESS
    don´t.
    (I´no newby to programming environments, I´ve got
    some 12 years daily working experience with assembly, c and c++
    languages, and flash actionscript)
    and by the way, did you notice the sound behavior differences
    between the AS 2.0 and 3.0 versions ??
    and it should be noted that these examples have just an
    illustrative goal. My actual code has several actions inside the
    buttons, but the same problem remains under AS3.0 (Obviously, under
    the coded version, my program abides by the AS 2.0 and AS 3.0
    methods and coding conventions, respectively).

  • Some strange problem with Flash/As3

    Hi,
    I am having some strange problem with my flash cs3.
    Whatever script I write in as3  doesn't work, even a stop() function doesn't work . But when I change my publish setting to as2 it works fine.
    Not sure about the root cause, may be some setting or preference or my cs3 is corrupted.
    Can anybody please advise.
    Thanks,
    Kishor

    try this
    create a new fla as3,
    select frame 1
    open the actions panel
    paste in the following code
    var squares:Array = new Array;
    setup();
    function setup():void {
        for (var i = 0; i < 25; i++) {
            var square:Sprite = new Sprite();
            //square.name = "square" + i;
            square.graphics.beginFill(Math.random() * 0xffffff);
            squares.push(square);
            squares[i].graphics.drawRect(0, 0, 100, 100);
            squares[i].x = i*3;
            squares[i].y = i*3;
            squares[i].filters = [];
            square.graphics.endFill();
            stage.addChild(squares[i]);
    for (var j = 0; j < squares.length; j++) {
        squares[j].addEventListener(MouseEvent.MOUSE_DOWN, dragMovie);
        squares[j].addEventListener(MouseEvent.MOUSE_UP, dropMovie);
        squares[j].buttonMode = true;
    function dragMovie(event:MouseEvent):void {
        event.target.startDrag();
    function dropMovie(event:MouseEvent):void {
        event.target.stopDrag();

Maybe you are looking for

  • Eratic freezes in OS 10.8.2

    Ever since I installed Mountain Lion, my Mac Pro has been behaving oddly. It goes into freezes, crashes during restarts and loses the disk Time Machine is supposed to back up to. I seem to be noticing that this only occurs when several (heavy) applic

  • No Signal

    OS Name Microsoft Windows 7 Professional Version 6.1.7601 Service Pack 1 Build 7601 System Model h8-1090t System Type x64-based PC Processor Intel(R) Core(TM) i7 CPU 970 @ 3.20GHz AMD Radeon HD 6850        A few days ago I was working on my computer

  • Is it possible to search for keywords in an XML file?

    Hey all, I'm currently searching for ways to count the number of pre-defined keywords in an XML file. An example would be trying to find how many times "war" is mentioned in a news networks RSS feed <title></title> and adding it to a variable. I've f

  • Resrore Previous Session does not work in FF6

    FF6 does not save tabs, etc. when closed -- unexpectedly or by File==>Exit or by History==>Restore Previous Session (option is greyed out). No "Restore Precious Session" button appears on opening page.

  • HT4539 How come i don't have any software update on the general tab

    I was trying to update and when i went to general tab software update is not on the drop down choices