"Fossies" - the Fresh Open Source Software Archive

Member "gnash-0.8.10/testsuite/misc-swfc.all/action_execution_order_test12.sc" (19 Jan 2012, 4864 Bytes) of package /linux/www/old/gnash-0.8.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Paradox source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2  *   Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
    3  * 
    4  * This program is free software; you can redistribute it and/or modify
    5  * it under the terms of the GNU General Public License as published by
    6  * the Free Software Foundation; either version 3 of the License, or
    7  * (at your option) any later version.
    8  * 
    9  * This program is distributed in the hope that it will be useful,
   10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   12  * GNU General Public License for more details.
   13  * You should have received a copy of the GNU General Public License
   14  * along with this program; if not, write to the Free Software
   15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   16  *
   17  */ 
   18 
   19 /*
   20  * Zou Lunkai, zoulunkai@gmail.com
   21  * 
   22  * Test actions execution order.
   23  *
   24  * movieclips hiberarchy:
   25  *
   26  *   _root.frame2.mc1;  
   27  *   _root.frame2.mc2;  
   28  *
   29  *     mc1.frame2.mc11
   30  *     mc1.frame4.mc12 (mc1 has 4 frames)
   31  *
   32  *     mc2.frame3.mc21 (mc2 has 3 frames)
   33  * 
   34  */
   35 
   36 
   37 .flash  bbox=800x600 filename="action_execution_order_test12.swf" background=white version=7 fps=12
   38 
   39 .frame 1
   40   .action:
   41    #include "Dejagnu.sc"
   42    
   43    _root.loadOrder = '0+';
   44    _root.enterFrameOrder = '0+';
   45    _root.unloadOrder = '0+';
   46   .end
   47   
   48   // Define 3 shapes(b1, b2, b3)
   49   .box b1 fill=green width=100 height=100
   50   .box b2 fill=red width=100 height=100
   51   .box b3 fill=yellow width=100 height=100
   52   .box b4 fill=blue width=100 height=100
   53 
   54 .frame 2
   55   
   56   .sprite mc11 // Define mc11
   57     .frame 1 .put b1
   58   .end 
   59   
   60   .sprite mc12 // Define mc12
   61     .frame 1 .put b2
   62   .end
   63   
   64   .sprite mc21 // Define mc21
   65     .frame 1 .put b3
   66   .end
   67   
   68   .sprite mc1 // Define mc1
   69     .frame 2 .put mc11
   70     .frame 4 .put mc12
   71   .end
   72   
   73   .sprite mc2 // Define mc2
   74     .frame 3 .put mc21
   75   .end
   76   
   77   
   78 
   79 .frame 3
   80   .put mc1  // Place mc1
   81   .put mc2  // Place mc2
   82   
   83   
   84   .action:
   85     mc1.onLoad = function () {
   86       _root.loadOrder += '1+';
   87     };
   88     mc1.onEnterFrame = function () {
   89       _root.enterFrameOrder += '2+';
   90     };
   91     mc1.onUnload = function () {  
   92       _root.note('mc1 unloaded');  
   93       _root.unloadOrder += '4+';  
   94     };
   95     
   96     mc2.onLoad = function () {
   97       _root.loadOrder += '2+';
   98     };
   99     mc2.onEnterFrame = function () {
  100       _root.enterFrameOrder += '1+';
  101     };
  102     mc2.onUnload = function () {
  103       _root.note('mc2 unloaded');
  104       _root.unloadOrder += '5+';
  105     };
  106     
  107     check_equals(typeof(mc2), 'movieclip');
  108     check_equals(typeof(mc2), 'movieclip');
  109     check_equals(typeof(mc1.mc11), 'undefined');
  110     check_equals(typeof(mc1.mc12), 'undefined');
  111     check_equals(typeof(mc1.mc21), 'undefined');
  112   .end
  113     
  114 
  115   
  116 .frame 4
  117   .action:
  118     mc1.mc11.onLoad = function () {
  119       _root.loadOrder += '3+';
  120     };
  121     mc1.mc11.onEnterFrame = function () {
  122       _root.enterFrameOrder += '3+';
  123     };
  124     mc1.mc11.onUnload = function () {
  125       _root.note('mc1.mc11 unloaded');
  126       _root.unloadOrder += '2+';
  127     };
  128     
  129     check_equals(typeof(mc1.mc11), 'movieclip');
  130     check_equals(typeof(mc1.mc12), 'undefined');
  131   .end
  132  
  133 
  134 .frame 5
  135   .action:
  136     mc2.mc21.onLoad = function () {
  137       _root.loadOrder += '4+';
  138     };
  139     mc2.mc21.onEnterFrame = function () {
  140       _root.enterFrameOrder += '4+';
  141     };
  142     mc2.mc21.onUnload = function () {
  143      _root.note('mc2.mc21 unloaded');
  144       _root.unloadOrder += '1+';
  145     };
  146     
  147     check_equals(typeof(mc2.mc21), 'movieclip');
  148     check_equals(typeof(mc1.mc12), 'undefined');
  149   .end 
  150 
  151 .frame 6
  152   .action:
  153     mc1.mc12.onLoad = function () {
  154       _root.loadOrder += '5+';
  155     };
  156     mc1.mc12.onEnterFrame = function () {
  157       _root.enterFrameOrder += '5+';
  158     };
  159     mc1.mc12.onUnload = function () {
  160         _root.note('mc1.mc12 unloaded');
  161       _root.unloadOrder += '3+';
  162     };
  163     
  164     check_equals(typeof(mc1.mc12), 'movieclip');
  165   .end 
  166   
  167   
  168 .frame 8
  169     .del mc1
  170     .del mc2
  171   .action:
  172       check_equals(_root.loadOrder, '0+');
  173       check_equals(_root.enterFrameOrder, '0+1+2+3+1+2+3+1+2+1+2+');
  174       // mc2.mc21, mc1.mc11 and mc1.mc12 were unloaded when loop back.
  175       // mc1 and mc2 were unloaded by RemoveObject2 tags.
  176       check_equals(_root.unloadOrder, '0+1+2+3+4+5+');
  177   .end
  178 
  179 
  180 //
  181 // test2:
  182 //   test that a single action block can be interrupted by passing-by init actions 
  183 .frame 9
  184     .action:
  185         _root.asOrder = '0+';
  186         gotoAndPlay(11);
  187         _root.asOrder += '1+';
  188         func = function () { _root.asOrder += '2+'; };
  189         func();
  190         _root.asOrder += '4+';
  191     .end
  192 
  193 .frame 10
  194     .sprite mc3
  195     .end
  196     .initaction mc3:
  197         _root.asOrder += '3+';
  198     .end
  199     
  200 .frame 11
  201     .action:
  202         check_equals(asOrder, '0+1+2+3+4+');
  203     .end
  204 
  205 .frame 15
  206     .action:
  207         totals(); stop();
  208     .end
  209     
  210       
  211 .end // end of the file