⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 actionwriter.java

📁 java版本的flash文件(swf)播放器
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    public void pop() throws IOException
    {
        writeCode( POP );
    }
    
    /**
     * SWFActions interface
     */
    public void add() throws IOException
    {
        writeCode( ADD );
    }

    /**
     * SWFActions interface
     */
    public void substract() throws IOException
    {
        writeCode( SUBTRACT );
    }

    /**
     * SWFActions interface
     */
    public void multiply() throws IOException
    {
        writeCode( MULTIPLY );
    }

    /**
     * SWFActions interface
     */
    public void divide() throws IOException
    {
        writeCode( DIVIDE );
    }
    
    /**
     * SWFActions interface
     */
    public void equals() throws IOException
    {
        writeCode( EQUALS );
    }
   
    /**
     * SWFActions interface
     */
    public void lessThan() throws IOException
    {
        writeCode( LESS );
    }
    
    /**
     * SWFActions interface
     */
    public void and() throws IOException
    {
        writeCode( AND );
    }
   
    /**
     * SWFActions interface
     */
    public void or() throws IOException
    {
        writeCode( OR );
    }
    
    /**
     * SWFActions interface
     */
    public void not() throws IOException
    {
        writeCode( NOT );
    }
    
    /**
     * SWFActions interface
     */
    public void stringEquals() throws IOException
    {
        writeCode( STRING_EQUALS );
    }

    /**
     * SWFActions interface
     */
    public void stringLength() throws IOException
    {
        writeCode( STRING_LENGTH );
    }
    
    /**
     * SWFActions interface
     */
    public void concat() throws IOException
    {
        writeCode( STRING_ADD );
    }
    
    /**
     * SWFActions interface
     */
    public void substring() throws IOException
    {
        writeCode( STRING_EXTRACT );
    }
    
    /**
     * SWFActions interface
     */
    public void stringLessThan() throws IOException
    {
        writeCode( STRING_LESS );
    }
    
    /**
     * SWFActions interface
     */
    public void stringLengthMB() throws IOException
    {
        writeCode( MB_STRING_LENGTH );
    }

    /**
     * SWFActions interface
     */
    public void substringMB() throws IOException
    {
        writeCode( MB_STRING_EXTRACT );
    }    

    /**
     * SWFActions interface
     */
    public void toInteger() throws IOException
    {
        writeCode( TO_INTEGER );
    }

    /**
     * SWFActions interface
     */
    public void charToAscii() throws IOException
    {
        writeCode( CHAR_TO_ASCII );
    }

    /**
     * SWFActions interface
     */
    public void asciiToChar() throws IOException
    {
        writeCode( ASCII_TO_CHAR );
    }

    /**
     * SWFActions interface
     */
    public void charMBToAscii() throws IOException
    {
        writeCode( MB_CHAR_TO_ASCII );
    }

    /**
     * SWFActions interface
     */
    public void asciiToCharMB() throws IOException
    {
        writeCode( MB_ASCII_TO_CHAR );
    }
    
    /**
     * SWFActions interface
     */
    public void call() throws IOException
    {
        writeCode( CALL );
        out.writeUI16( 0 );   //SWF File Format anomaly
    }

    /**
     * SWFActions interface
     */
    public void getVariable() throws IOException
    {
        writeCode( GET_VARIABLE );
    }

    /**
     * SWFActions interface
     */
    public void setVariable() throws IOException
    {
        writeCode( SET_VARIABLE );
    }
    
    /**
     * SWFActions interface
     */
    public void getURL( int sendVars, int loadMode ) throws IOException
    {
        writeCode( GET_URL_2 );
        out.writeUI16( 1 );

        int flags = 0;
        
        String sendVars_ = null;
        switch( sendVars )
        {
            case GET_URL_SEND_VARS_GET:  flags = 1; break;
            case GET_URL_SEND_VARS_POST: flags = 2; break;
                                         
            case GET_URL_SEND_VARS_NONE:
            default: break;
        }
        
        String mode = null;
        switch( loadMode )
        {
            case GET_URL_MODE_LOAD_MOVIE_INTO_LEVEL:  break;                
            case GET_URL_MODE_LOAD_MOVIE_INTO_SPRITE: flags |= 0x40; break;
            case GET_URL_MODE_LOAD_VARS_INTO_LEVEL :  flags |= 0x80; break;
            case GET_URL_MODE_LOAD_VARS_INTO_SPRITE:  flags |= 0xC0; break;
            default: break;
        }
        
        out.writeUI8( flags );        
    }
    
    
    /**
     * SWFActions interface
     */
    public void gotoFrame( boolean play ) throws IOException
    {
        writeCode( GOTO_FRAME_2 );
        out.writeUI16( 1 );
        out.writeUI8( play ? 1 : 0 );
    }
    
    /**
     * SWFActions interface
     */
    public void setTarget() throws IOException
    {
        writeCode( SET_TARGET_2 );
    }
    
    /**
     * SWFActions interface
     */
    public void getProperty() throws IOException
    {
        writeCode( GET_PROPERTY );
    }
    
    /**
     * SWFActions interface
     */
    public void setProperty() throws IOException
    {
        writeCode( SET_PROPERTY );
    }
    
    /**
     * SWFActions interface
     */
    public void cloneSprite() throws IOException
    {
        writeCode( CLONE_SPRITE );
    }
    
    /**
     * SWFActions interface
     */
    public void removeSprite() throws IOException
    {
        writeCode( REMOVE_SPRITE );
    }
    
    /**
     * SWFActions interface
     */
    public void startDrag() throws IOException
    {
        writeCode( START_DRAG );
    }
    
    /**
     * SWFActions interface
     */
    public void endDrag() throws IOException
    {
        writeCode( END_DRAG );
    }     
    
    /**
     * SWFActions interface
     */
    public void trace() throws IOException
    {
        writeCode( TRACE );
    }     
    
    /**
     * SWFActions interface
     */
    public void getTime() throws IOException
    {
        writeCode( GET_TIME );
    }     
     
    /**
     * SWFActions interface
     */
    public void randomNumber() throws IOException
    {
        writeCode( RANDOM_NUMBER );
    }         
     
    /**
     * SWFActions interface
     */
    public void lookupTable( String[] values ) throws IOException
    {
        writeCode( LOOKUP_TABLE );
        
        ByteArrayOutputStream baout = new ByteArrayOutputStream();
        OutStream bout = new OutStream( baout );
        
        bout.writeUI16( values.length );
        
        for( int i = 0; i < values.length; i++ )
        {
            bout.writeString( values[i], mStringEncoding );
        }

        bout.flush();
        byte[] data = baout.toByteArray();
        out.writeUI16( data.length );
        out.write( data );        
    }
     
    /**
     * SWFActions interface
     */    
    public void callFunction() throws IOException
    {
        writeCode( CALL_FUNCTION );
    }         
     
    /**
     * SWFActions interface
     */                                      
    public void callMethod() throws IOException
    {
        writeCode( CALL_METHOD );
    }         
     
    /**
     * SWFActions interface
     */     
    public void startFunction( String name, String[] paramNames ) throws IOException
    {
        if( blockStack == null ) blockStack = new Stack();
        
        writeCode( DEFINE_FUNCTION );        
        
        ByteArrayOutputStream baout = new ByteArrayOutputStream();
        OutStream bout = new OutStream( baout );
        
        bout.writeString( name, mStringEncoding );
        bout.writeUI16( paramNames.length );
        
        for( int i = 0; i < paramNames.length; i++ )
        {
            bout.writeString( paramNames[i], mStringEncoding );
        }

        bout.writeUI16( 0 );  //code size - will be fixed up later
        
        bout.flush();
        byte[] data = baout.toByteArray();
        out.writeUI16( data.length );
        out.write( data );
        
        blockStack.push( new int[]{ (int)out.getCount(), 0 } );
    }    

    /**
     * SWFActions interface
     */     
    public void endBlock() throws IOException 
    {
        if( blockStack == null || blockStack.isEmpty() ) return;  //nothing to do
        int[] blockInfo = (int[])blockStack.pop();
                
        if( blocks == null ) blocks = new Vector();
        
        int offset =  blockInfo[0];
        int codeSize = ((int)out.getCount()) - offset;
        
        //--store this info for later fix-up
        blockInfo[0] = offset - 2;
        blockInfo[1] = codeSize;
        blocks.addElement( blockInfo );
    }
    
    /**
     * SWFActions interface
     */     
    public void defineLocalValue() throws IOException
    {
        writeCode( DEFINE_LOCAL_VAL );
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -