tsp menu start.
The Summer Project Interface Menu Class
...
TSPIMC. lol.
♥0 |
Line 129 |
Modified 2009-09-21 06:48:14 |
MIT License
archived:2017-03-20 03:39:51
ActionScript3 source code
/**
* Copyright aznFanBoy ( http://wonderfl.net/user/aznFanBoy )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/8rJp
*/
//The Summer Project Interface Menu Class
//...
//TSPIMC. lol.
package
{
import flash.display.Sprite
import flash.display.Loader
import flash.display.Graphics
import flash.display.LoaderInfo
import flash.display.Stage
import flash.display.StageAlign
import flash.display.StageQuality
import flash.display.StageScaleMode
import flash.ui.ContextMenu
import flash.ui.ContextMenuItem
import flash.ui.ContextMenuBuiltInItems
import flash.text.TextField
import flash.text.TextFormat
import flash.display.Stage
import flash.filters.BlurFilter
import flash.filters.GlowFilter
import gs.TweenLite
import gs.easing.Expo
import flash.net.FileFilter
import flash.net.FileReference
import flash.net.URLLoader
import flash.net.URLRequest
import flash.net.navigateToURL
import flash.net.SharedObject
import flash.xml.XMLNode
import flash.xml.XMLDocument
import flash.events.*
import flash.errors.*
import flash.system.Security
public class tsp_menu extends Sprite
{
//[Embed(source="C:\WINDOWS\Fonts\FFF Harmony.ttf", fontFamily="FFF Harmony")]
private var accent_colour:uint = new uint( 0x38CBF5 )
private var accent_colour_or:uint = new uint( 0xFAAB39 )
private var dropbox_num:uint = new uint( 1680728 )
private var curr_user:int = new int(-94)
private var curr_song:int = new int(-94)
private var first_time:Boolean = new Boolean( true )
private var user_names:Array = new Array()
private var user_passwords:Array = new Array()
private var user_locations:Array = new Array()
private var user_instruments:Array = new Array()
private var song_titles:Array = new Array()
private var song_urls:Array = new Array()
private var song_authors:Array = new Array()
private var blur_fltr:BlurFilter = new BlurFilter( 0, 8, 1 )
//Use 8 or 16 as they render quickly
private var xml_rqst:URLRequest;
private var xml_ldr:URLLoader;
private var _xml:XML;
private var txt_fmt:TextFormat;
private var txt_fmt_or:TextFormat;
private var menu:ContextMenu;
private var high_cmi:ContextMenuItem = new ContextMenuItem( "High Quality", false, false )
private var med_cmi:ContextMenuItem = new ContextMenuItem( "Medium Quality", false, true )
private var low_cmi:ContextMenuItem = new ContextMenuItem( "Low Quality", false, true )
private var contact_cmi:ContextMenuItem = new ContextMenuItem( "Contact", false, true )
private var shameless_cmi:ContextMenuItem = new ContextMenuItem( "Created by ~aznFanBoy", true, true)
public function tsp_menu( ):void {
Security.allowInsecureDomain( "paulyoon.deviantart.com" )
xml_rqst = new URLRequest( "http://dl.getdropbox.com/u/" + dropbox_num + "/The%20Summer%20Project/TheSummerProject.xml" );
txt_fmt = new TextFormat( "FFF Harmony", 8, accent_colour )
txt_fmt_or = new TextFormat( "FFF Harmony", 8, accent_colour_or )
addEventListener( Event.ADDED_TO_STAGE, init )
}
private function init( event:Event ):void {
stage.align = StageAlign.TOP_LEFT
stage.quality = StageQuality.BEST
stage.scaleMode = StageScaleMode.NO_SCALE
menu = new ContextMenu()
menu.hideBuiltInItems()
menu.customItems.push( high_cmi, med_cmi, low_cmi, contact_cmi, shameless_cmi )
high_cmi.addEventListener( ContextMenuEvent.MENU_ITEM_SELECT, high_quality )
med_cmi.addEventListener( ContextMenuEvent.MENU_ITEM_SELECT, med_quality )
low_cmi.addEventListener( ContextMenuEvent.MENU_ITEM_SELECT, low_quality )
contact_cmi.addEventListener( ContextMenuEvent.MENU_ITEM_SELECT, contact_tsp )
shameless_cmi.addEventListener( ContextMenuEvent.MENU_ITEM_SELECT, contact_shameless )
this.contextMenu = menu
}
//
//--Context Menu
//
private function high_quality( event:ContextMenuEvent ):void {
stage.quality = StageQuality.BEST
high_cmi.enabled = false
med_cmi.enabled = true
low_cmi.enabled = true
}
private function med_quality( event:ContextMenuEvent ):void {
stage.quality = StageQuality.HIGH
high_cmi.enabled = true
med_cmi.enabled = false
low_cmi.enabled = true
}
private function low_quality( event:ContextMenuEvent ):void {
stage.quality = StageQuality.MEDIUM
high_cmi.enabled = true
med_cmi.enabled = true
low_cmi.enabled = false
}
private function contact_tsp( event:ContextMenuEvent ):void {
//Change if php mail is used.
navigateToURL( new URLRequest( "mailto:thisisnotschoolrelated@gmail.com" ) )
}
private function contact_shameless( event:ContextMenuEvent ):void {
navigateToURL( new URLRequest( "http://aznFanBoy.deviantart.com" ), "_self" )
}
//
//--xml init
//
private function init_xml( url_rqst:URLRequest ):void {
xml_ldr.addEventListener( Event.COMPLETE, xml_loaded )
xml_ldr.load( xml_rqst )
}
private function xml_loaded( evevnt:Event ):void {
_xml = XML( xml_ldr.data )
parse_xml( _xml )
}
private function parse_xml( target_xml:XML ):void {
try
{
var xml_names:XMLList = target_xml.person.attributes( "name" )
var xml_password:XMLList = target_xml.person.attributes( "password" )
var xml_location:XMLList = target_xml.person.attributes( "location" )
var xml_instruments:XMLList = target_xml.person.attributes( "instruments" )
}
catch ( error:IOError )
{
//error_message( error )
}
for each( var temp_xml:XML in xml_names ) {
user_names.push( temp_xml )
trace( typeof temp_xml )
}
}
}
}