Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-22-2010, 04:12 PM
Member
 
Join Date: Apr 2005
Location: Antwerp, Belgium
Posts: 40
Default handling Application.Appearance methods from AS3

Hi,

I have a ffish-script function that makes an exe go to fullscreen or to fixed-size mode depending on the choice of the user:

Code:
function handleMenu() {
    var menu = new Menu;
            
    menu.load("MainMenu");
    menu = menu.getSubMenu(0) ;
    switch (menu.show())
    {
    case "fullScreen":
        Application.Appearance.borderStyle = $BSNONE 
        Application.Appearance.scaleMode = $SMNORMAL 
        Application.SizeAndPos.windowSize = $SSFULLSCREEN 
        Application.Interaction.lBtnClk = $LBSEND 
        break;
    case "normalSize":
        Application.Appearance.borderStyle = $BSNONE 
        Application.SizeAndPos.setCustomSize(1024,600) 
        Application.Appearance.scaleMode = $SMNORMAL 
        Application.SizeAndPos.windowSize = $SSDEFAULT
        Application.Interaction.lBtnClk = $LBDRAG 
        break;
    case "close":
		var wnd = getMainWnd();
		wnd.close();
        break;
    }
    
    
}

FlashPlayer.onContextMenu = function () {
	handleMenu();
}
This works well - however we want to do the same from within an AS3 class.
So how do we port the ffish script into AS3 classes? I could not find any documentation on it

thanks a lot
Reply With Quote
  #2 (permalink)  
Old 03-24-2010, 11:26 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default

Code:
import SWFKit.*;
import SWFKit.application.*;

function handleMenu() {
    var m:Menu = new Menu;
	var appr = new Appearance;
	var snp = new SizeAndPos;
	var intr = new Interaction;
            
    m.load("MainMenu");
    var menu:Menu = m.getSubMenu(0) ;
    switch (menu.show())
    {
    case "fullScreen":
        appr.borderStyle = Appearance.BSNONE;
        appr.scaleMode = Appearance.SMNORMAL; 
        snp.windowSize = SizeAndPos.SSFULLSCREEN; 
        intr.lBtnClk = Interaction.LBSEND; 
        break;
    case "normalSize":
        appr.borderStyle = Appearance.BSNONE;
        snp.setCustomSize(1024,600); 
        appr.scaleMode = Appearance.SMNORMAL;
        snp.windowSize = SizeAndPos.SSDEFAULT;
        intr.lBtnClk = Interaction.LBDRAG; 
        break;
    case "close":
		var wnd = Global.getMainWnd();
		wnd.close();
        break;
    }
    
	appr.Release();
	snp.Release();
	intr.Release();
	m.Release();
	menu.Release();
    
}

var fp = new FlashPlayer;
fp.setEventHandler("onContextMenu", handleMenu);
fp.Release();
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:08 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.