commit
stringlengths
40
40
old_file
stringlengths
2
205
new_file
stringlengths
2
205
old_contents
stringlengths
0
32.9k
new_contents
stringlengths
1
38.9k
subject
stringlengths
3
9.4k
message
stringlengths
6
9.84k
lang
stringlengths
3
13
license
stringclasses
13 values
repos
stringlengths
6
115k
3af5a3a3d97a0e27fb78620b800b2f73d22b9b74
src/Impetus.as
src/Impetus.as
package io.github.jwhile.impetus { import flash.display.Sprite; import flash.external.ExternalInterface; public class Impetus extends Sprite { public function Impetus():void { } } }
Add class Impetus
Add class Impetus
ActionScript
mit
Julow/Impetus
db3bdb8918d4514f87cad2138515865de993f165
dolly-framework/src/main/actionscript/dolly/utils/CopyUtil.as
dolly-framework/src/main/actionscript/dolly/utils/CopyUtil.as
package dolly.utils { public class CopyUtil { } }
Add empty utility class CopyUtil.
Add empty utility class CopyUtil.
ActionScript
mit
Yarovoy/dolly
ad5514e6400c9edbac893f3ac53d3124dc85b859
dolly-framework/src/main/actionscript/dolly/core/dolly_internal.as
dolly-framework/src/main/actionscript/dolly/core/dolly_internal.as
package dolly.core { public namespace dolly_internal; }
Add namespace "dolly_internal".
Add namespace "dolly_internal".
ActionScript
mit
Yarovoy/dolly
d79c8b906b2bf5f434aeb6f34666db2c354349b5
src/com/ryanberdeen/utils/MD5Calculator.as
src/com/ryanberdeen/utils/MD5Calculator.as
package com.ryanberdeen.utils { import com.adobe.crypto.MD5Stream; import flash.events.Event; import flash.events.EventDispatcher; import flash.events.ProgressEvent; import flash.utils.ByteArray; import flash.utils.Timer; public class MD5Calculator extends EventDispatcher { private var timer:Timer; private var stream:MD5Stream; private var buffer:ByteArray; private var source:ByteArray; private var _md5:String; private var _delay:int; private var _chunkSize:int; private var dispatchProgressEvent:Boolean; public function MD5Calculator() { _delay = 1; _chunkSize = 51200; } public function set delay(delay:int):void { _delay = delay; } public function set chunkSize(chunkSize:int):void { _chunkSize = chunkSize; } public function get md5():String { return _md5; } public function calculate(source:ByteArray):void { this.source = source; dispatchProgressEvent = hasEventListener(ProgressEvent.PROGRESS); stream = new MD5Stream(); buffer = new ByteArray(); source.position = 0; timer = new Timer(_delay);; timer.addEventListener('timer', iterate); timer.start(); } private function iterate(e:Event):void { if (source.bytesAvailable == 0) { timer.stop(); timer = null; _md5 = stream.complete(); stream = null; buffer = null; source = null; dispatchEvent(new Event(Event.COMPLETE)); return; } var length:int = Math.min(_chunkSize, source.bytesAvailable); buffer.length = length; source.readBytes(buffer, 0, length); stream.update(buffer); if (dispatchProgressEvent) { var progressEvent:ProgressEvent = new ProgressEvent(ProgressEvent.PROGRESS); progressEvent.bytesLoaded = source.position; progressEvent.bytesTotal = source.length dispatchEvent(progressEvent); } } public function stop():void { timer.stop(); } } }
add async md5 calculator utility class
add async md5 calculator utility class
ActionScript
mit
also/echo-nest-flash-api
a96e5bd8bd030ac2915ff03da090a5389e8e5889
src/test/actionscript/com/dotfold/dotvimstat/mediator/MediatorTest.as
src/test/actionscript/com/dotfold/dotvimstat/mediator/MediatorTest.as
package com.dotfold.dotvimstat.mediator { public class MediatorTest { } }
add mediator test
[test] add mediator test
ActionScript
mit
dotfold/dotvimstat
efca752980aea3c14403a6df05782eaeff1d7e59
src/aerys/minko/ns/minko_animation.as
src/aerys/minko/ns/minko_animation.as
// ActionScript file package aerys.minko.ns { public namespace minko_animation; }
Add Animation namespace and modification for timelines
Add Animation namespace and modification for timelines A New namespace to access confidential information inside timelines M Each timeline has two new getter, need namespace minko_animation to use them
ActionScript
mit
aerys/minko-as3
2d1c2f240fee0c9b2d7254097e108742689aca75
src/corsaair/server/spitfire/SimpleSocketServerSelect5.as
src/corsaair/server/spitfire/SimpleSocketServerSelect5.as
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package corsaair.server.spitfire { import C.errno.*; import C.arpa.inet.*; import C.netdb.*; import C.netinet.*; import C.sys.socket.*; import C.sys.select.*; import C.stdlib.*; import C.unistd.*; import flash.utils.getTimer; import flash.utils.ByteArray; import flash.utils.Dictionary; import flash.system.Worker; import flash.system.WorkerDomain; import flash.concurrent.Mutex; /** * A simple socket server upgrade 5. * * If you look back at the very first example * you will notcie that at that time we totally ignored * something named fork() in the C source code * * fork() is a very convenient C function in the POSIX world * which allow to create a new process (child process) * that is an exact copy of the calling process (parent process) * see: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fork.html * * in server.c we can see * if (!fork()) { // this is the child process * close(sockfd); // child doesn't need the listener * if (send(new_fd, "Hello, world!", 13, 0) == -1) * perror("send"); * close(new_fd); * exit(0); * } * * In Redtamarin we deliberately decided to not support fork() * mainly because it works only with true POSIX systems * like Linux and Mac OS X but fail miserably under Windows * but also because we run our code inse a VM (AVM2) * and we can not as easily copy our process like that. * * But wait we have something as good as fork() * and which work everywhere, something called workers. * * Here how we want tto manage it for now: * var server = new SimpleSocketServerSelect5(); * server.sleepTime = 1000; * * if( Worker.current.isPrimordial ) * { * server.main(); * } * else * { * server.registerNewArrival(); * } * * basically, if we are the server we want to run main() * and if we are a client connecting we want to run registerNewArrival() * * But workers and fork() does not work exactly the same * even if a background worker will create a virtual copy of the VM (AVM2) * sharing data works differently. * * The main point is to be able to extract the part thart is blocking forever * outside of the main process. * * Here, our registration is something that can block forever * so for this part we want to run a worker so the worker will block * while our main server will not block. */ public class SimpleSocketServerSelect5 { // the port users will be connecting to public const PORT:String = "3490"; // how many pending connections queue will hold public const BACKLOG:uint = 10; private var _address:Array; // list of addresses private var _info:addrinfo; // server selected address private var _run:Boolean; // run the server loop public var serverfd:int; // server socket descriptor public var selected:int; // selected socket descriptor public var connections:Array; // list of socket descriptor public var clients:Dictionary; // list of clients informations public var sleepTime:uint; // time is expressed in milliseconds private var _mutex:Mutex; public var sharedData:ByteArray; public function SimpleSocketServerSelect5() { super(); _address = []; _info = null; _run = true; serverfd = -1; selected = -1; connections = []; clients = new Dictionary(); sleepTime = 0; // 0 means "do not sleep" sharedData = new ByteArray(); sharedData.shareable = true; } private function _getBindingSocket():int { var hints:addrinfo = new addrinfo(); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; // indicates we want to bind var info:addrinfo; var eaierr:CEAIrror = new CEAIrror(); var addrlist:Array = getaddrinfo( null, PORT, hints, eaierr ); if( !addrlist ) { throw eaierr; } var sockfd:int; var option:int; var bound:int; var i:uint; var len:uint = addrlist.length; for( i = 0; i < len; i++ ) { info = addrlist[i]; sockfd = socket( info.ai_family, info.ai_socktype, info.ai_protocol ); if( sockfd == -1 ) { trace( "selectserver: socket" ) trace( new CError( "", errno ) ); continue; } option = setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR, 1 ); if( option == -1 ) { trace( "setsockopt" ); trace( new CError( "", errno ) ); exit( 1 ); } bound = bind( sockfd, info.ai_addr ); if( bound == -1 ) { close( sockfd ); trace( "selectserver: bind" ); trace( new CError( "", errno ) ); continue; } // we save the selected addrinfo _info = info; break; } // we merge the addresses found into our list of address _address = _address.concat( addrlist ); // we return the socket descriptor return sockfd; } private function _loopConnections():void { var i:uint; var len:uint = connections.length; for( i = 0; i < len; i++ ) { selected = connections[i]; if( isReadable( selected ) ) { if( selected == serverfd ) { _handleNewConnections(); } else { _handleClientData(); } } } } private function _handleNewConnections():void { // handle new connections var new_fd:int; // newly accept()ed socket descriptor var client_addr:sockaddr_in = new sockaddr_in(); new_fd = accept( serverfd, client_addr ); if( new_fd == -1 ) { trace( "accept" ); trace( new CError( "", errno ) ); } else { _addClient( new_fd ); var s:String = inet_ntop( client_addr.sin_family, client_addr ); trace( "selectserver: new connection from " + s + ", socket " + new_fd ); var msg_out:String = "Hello, world!\n"; var bytes_out:ByteArray = new ByteArray(); bytes_out.writeUTFBytes( msg_out ); bytes_out.position = 0; var sent:int = send( new_fd, bytes_out ); if( sent == -1 ) { trace( "send" ); trace( new CError( "", errno ) ); } else { trace( "sent " + sent + " bytes to the client " + new_fd ); } //registerNewArrival( new_fd ); /* Note: It's here that we split the process by creating a worker */ trace( "setup worker and start it" ); var newArrival:Worker = WorkerDomain.current.createWorkerFromPrimordial(); newArrival.setSharedProperty( "clientfd", new_fd ); newArrival.setSharedProperty( "mutex", _mutex ); newArrival.start(); } } private function _handleClientData():void { // handle data from a client var msg_in:String; var bytes_in:ByteArray = new ByteArray(); var received:int = recv( selected, bytes_in ); if( received <= 0 ) { // got error or connection closed by client if( received == 0 ) { // connection closed trace( "selectserver: socket " + selected + " hung up" ); } else { trace( "recv" ); trace( new CError( "", errno ) ); } close( selected ); // bye! // remove from master set _removeClient( selected ); } else { // we got some data from a client trace( "received " + received + " bytes from client " + selected ); bytes_in.position = 0; msg_in = bytes_in.readUTFBytes( bytes_in.length ); msg_in = msg_in.split( "\n" ).join( "" ); if( clients[selected].nickname != "" ) { trace( clients[selected].nickname + " : " + msg_in ); } else { trace( selected + " : " + msg_in ); } if( msg_in == "shutdown" ) { trace( "selectserver: received 'shutdown' command" ); _run = false; } } } private function _addClient( sd:int, name:String = "" ):void { connections.push( sd ); clients[ sd ] = { nickname: name }; } private function _removeClient( sd:int ):void { if( sd == serverfd ) { return; } var i:uint; var len:uint = connections.length; var desc:int; for( i = 0; i < len; i++ ) { desc = connections[i]; if( desc == sd ) { connections.splice( i, 1 ); delete clients[ sd ]; } } } private function _closeAndRemoveAllClients( removeServer:Boolean = false ):void { var i:uint; var desc:int; for( i = 0; i < connections.length; i++ ) { desc = connections[i]; if( !removeServer && (desc == serverfd) ) { continue; } if( clients[desc].nickname != "" ) { trace( "selectserver: terminate " + clients[desc].nickname + " (" + desc + ")" ); } else { trace( "selectserver: terminate " + desc ); } close( desc ); // close the socket connections.splice( i, 1 ); // remove the socket from the connections list delete clients[desc]; // delete the socket key for the clients data i = 0; //rewind } } public function sharedTrace( message:String ):void { _mutex.lock(); trace( message ); _mutex.unlock(); } public function getPrimordial():Worker { var wdomain:WorkerDomain = WorkerDomain.current; var workers:Vector.<Worker> = wdomain.listWorkers(); var worker:Worker; for( var i:uint = 0; i < workers.length; i++ ) { worker = workers[i]; if( worker.isPrimordial ) { return worker; } } return null; } /** * Register a new connected client. */ public function registerNewArrival():void { /* Note: Once we get our worker context we can obtain properties setup by the parent with getSharedProperty() be carefull here we use 2 workers - Worker.current: the current child or background worker - primordial: the parent or the primordial worker */ var cworker:Worker = Worker.current; var primordial:Worker = getPrimordial(); var clientfd:int = cworker.getSharedProperty( "clientfd" ); trace( "worker started" ); trace( "worker.state = " + cworker.state ); trace( "clientfd = " + clientfd ); var msg_welcome:String = "What is your nickname?\n"; var bytes_welcome:ByteArray = new ByteArray(); bytes_welcome.writeUTFBytes( msg_welcome ); bytes_welcome.position = 0; var welcome:int = send( clientfd, bytes_welcome ); if( welcome == -1 ) { trace( "selectserver: welcome sent" ); trace( new CError( "", errno ) ); close( clientfd ); _removeClient( clientfd ); return; } trace( "selectserver: wait for nickname ..." ); var bytes_answer:ByteArray = new ByteArray(); var nickname:String; var n:int; /* Note: we can still do a timeout but this time it runs isolated in a worker so let make it big like 60 seconds */ var timeA:uint = getTimer(); var timeB:uint; var diff:uint = 0; var timeout:uint = 60 * 1000; // 60 sec timeout while( true ) { timeB = getTimer(); diff = timeB - timeA; if( diff > timeout ) { trace( "selectserver: socket " + clientfd + " timed out" ); var bytes_bye:ByteArray = new ByteArray(); bytes_bye.writeUTFBytes( "You have been disconnected, bye\n" ); send( clientfd, bytes_bye ); close( clientfd ); _removeClient( clientfd ); break; } // only process if there is data in the pipe if( isReadable(clientfd) ) { n = recv( clientfd, bytes_answer ); if( n <= 0 ) { // got error or connection closed by client if( n == 0 ) { // connection closed trace( "selectserver: socket " + clientfd + " hung up" ); } else { trace( "recv" ); trace( new CError( "", errno ) ); } close( clientfd ); _removeClient( clientfd ); break; } else { bytes_answer.position = 0; nickname = bytes_answer.readUTFBytes( n ); nickname = nickname.split( "\n" ).join( "" ); /* Note: We can not use clients[ clientfd ].nickname = nickname; because the current var 'clients' is handled by the server but we can use a little trick to set a shared property on the primoridal worker (eg. the server) */ primordial.setSharedProperty( "nickname" + clientfd , nickname ); trace( "selectserver: socket " + clientfd + " registered as " + nickname ); break; } } } trace( "selectserver: terminating worker" ); var terminated:Boolean = cworker.terminate(); trace( "selectserver: terminated = " + terminated ); } private function _checkRegistration():void { /* Note: This can be run only from the server context because we need to access the 'childs' property and basically we use a stupid trick we loop trough all the connections to obtai nthe socket descriptor (we use it as an ID) and then we check the primordial worker shared property to see if a child has defined a nickname there eg. Server |_ childs[7].nickname = "" => worker: primordial.setSharedProperty( "nickname7", "the nickname chosen" ); => server loop nickname = primordial.getSharedProperty( "nickname7" ) if not empty childs[7].nickname = nickname yes, we have no events or promises and it is a bit of a pain to exchange data with the workers */ var primordial:Worker = Worker.current; for( var i:uint = 0; i < connections.length; i++ ) { var clientfd:uint = connections[i]; if( clients[clientfd].nickname == "" ) { var nickname:String = primordial.getSharedProperty( "nickname" + clientfd ); if( (nickname != undefined) && (nickname != 'null') && (nickname != "") ) { clients[clientfd].nickname = nickname; } } } } public function main():void { _mutex = new Mutex(); serverfd = _getBindingSocket(); if( _info == null ) { trace( "selectserver: failed to bind" ); exit( 1 ); } var listening:int = listen( serverfd, BACKLOG ); if( listening == -1 ) { trace( "listen" ); trace( new CError( "", errno ) ); exit( 1 ); } trace( "selectserver: waiting for connections..." ); // the server is always the first client to be added to the connections _addClient( serverfd, "server" ); trace( "selectserver: server on socket " + serverfd ); var frame:uint = 0; // main server loop while( _run ) { //trace( "selectserver: main loop" ); trace( "selectserver: main loop " + frame++ ); trace( "connections = " + connections.length ); // check for new registrations _checkRegistration(); _loopConnections(); if( sleepTime > 0 ) { sleep( sleepTime ); } } trace( "selectserver: connections left [" + connections + "]" ); _closeAndRemoveAllClients(); trace( "shutting down server" ); shutdown( serverfd, SHUT_RDWR ); close( serverfd ); exit( 0 ); } } }
add example using workers to prevent client blocking
add example using workers to prevent client blocking git-svn-id: 44dac414ef660a76a1e627c7b7c0e36d248d62e4@29 c2cce57b-6cbb-4450-ba62-5fdab5196ef5
ActionScript
mpl-2.0
Corsaair/spitfire
4c4eb553f1783d4f7f9caff5fad5a889480e7a68
src/avm2/tests/regress/correctness/pass/compression.as
src/avm2/tests/regress/correctness/pass/compression.as
import flash.utils.ByteArray; var data = new ByteArray(); data.writeUTFBytes('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc hendrerit, risus vel dapibus hendrerit, augue ipsum adipiscing lorem, quis orci aliquam.'); trace(data.length); data.deflate(); trace(data.length); data.inflate(); trace(data.length); trace(data.readUTFBytes(150));
Add AVM2 test case.
Add AVM2 test case.
ActionScript
apache-2.0
mozilla/shumway,mozilla/shumway,mbebenita/shumway,mozilla/shumway,yurydelendik/shumway,mbebenita/shumway,mbebenita/shumway,tschneidereit/shumway,yurydelendik/shumway,mbebenita/shumway,tschneidereit/shumway,tschneidereit/shumway,yurydelendik/shumway,mozilla/shumway,tschneidereit/shumway,yurydelendik/shumway,tschneidereit/shumway,mbebenita/shumway,mozilla/shumway,mozilla/shumway,yurydelendik/shumway,tschneidereit/shumway,tschneidereit/shumway,tschneidereit/shumway,yurydelendik/shumway,mozilla/shumway,mbebenita/shumway,mbebenita/shumway,mozilla/shumway,mbebenita/shumway,yurydelendik/shumway,yurydelendik/shumway
25eddab0ce5f8630a31167d217ddcdae458794e3
src/com/google/analytics/utils/getVersionFromString.as
src/com/google/analytics/utils/getVersionFromString.as
package com.google.analytics.utils { import core.version; public function getVersionFromString( v:String, separator:String = "." ):version { var ver:version = new version(); if( (v == "") || (v == null) ) { return ver; } if( v.indexOf( separator ) > -1 ) { var values:Array = v.split( separator ); ver.major = parseInt( values[0] ); ver.minor = parseInt( values[1] ); ver.build = parseInt( values[2] ); ver.revision = parseInt( values[3] ); } else { ver.major = parseInt( v ); } return ver; } }
add utility function to help core.version convert from a string
add utility function to help core.version convert from a string
ActionScript
apache-2.0
minimedj/gaforflash,nsdevaraj/gaforflash,minimedj/gaforflash,nsdevaraj/gaforflash
ed0b408e002e1a69dc9517271740de4f04b68678
src/corsaair/server/spitfire/SimpleSocketServerSelect.as
src/corsaair/server/spitfire/SimpleSocketServerSelect.as
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package corsaair.server.spitfire { import C.errno.*; import C.arpa.inet.*; import C.netdb.*; import C.netinet.*; import C.sys.socket.*; import C.sys.select.*; import C.stdlib.*; import C.unistd.*; import flash.utils.ByteArray; /** * A simple socket server upgrade 1. * * This time we do use a loop to listen and interact with multiple clients. * * @see http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#select a cheezy multiperson chat server */ public class SimpleSocketServerSelect { // the port users will be connecting to public const PORT:String = "3490"; // how many pending connections queue will hold public const BACKLOG:uint = 10; public function SimpleSocketServerSelect() { super(); } public function showAddressInfo1():void { var hints:addrinfo = new addrinfo(); var info:addrinfo; /* Note: because we want to bind eg. ai_flags = AI_PASSIVE it will automatically use the wildcard address 0.0.0.0 which means you're binding to every IP address on your machine */ hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; // indicate we want to bind var eaierr:CEAIrror = new CEAIrror(); var addrlist:Array = getaddrinfo( null, "http", hints, eaierr ); if( !addrlist ) { throw eaierr; } trace( "found " + addrlist.length + " addresses" ); for( var i:uint = 0; i < addrlist.length; i++ ) { info = addrlist[i]; trace( "[" + i + "] = " + inet_ntop( info.ai_family, info.ai_addr ) ); } } public function showAddressInfo2():void { var hints:addrinfo = new addrinfo(); var info:addrinfo; /* Note: Without ai_flags = AI_PASSIVE the first local address will be the loopback eg. 127.0.0.1 */ hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; var eaierr:CEAIrror = new CEAIrror(); var addrlist:Array = getaddrinfo( null, "http", hints, eaierr ); if( !addrlist ) { throw eaierr; } trace( "found " + addrlist.length + " addresses" ); for( var i:uint = 0; i < addrlist.length; i++ ) { info = addrlist[i]; trace( "[" + i + "] = " + inet_ntop( info.ai_family, info.ai_addr ) ); } } public function showAddressInfo3( hostname:String = "" ):void { /* Note: gethostname() will obtain your local hostname and use the IP address used on your local network for ex: 192.168.0.xyz if you pass a custom hostname like "www.as3lang.org" it will resolve to the IP address of that remote hostname it can also return many IP addresses depending on the remote hostname configuration, for ex: with something like cloudlfare it can returns 2 or more addresses etc. */ if( hostname == "" ) { hostname = gethostname(); } trace( "hostname = " + hostname ); var hints:addrinfo = new addrinfo(); var info:addrinfo; hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; var eaierr:CEAIrror = new CEAIrror(); var addrlist:Array = getaddrinfo( hostname, "http", hints, eaierr ); if( !addrlist ) { throw eaierr; } trace( "found " + addrlist.length + " addresses" ); for( var i:uint = 0; i < addrlist.length; i++ ) { info = addrlist[i]; trace( "[" + i + "] = " + inet_ntop( info.ai_family, info.ai_addr ) ); } } public function main():void { var sockfd:int; // listening socket descriptor var new_fd:int; // newly accept()ed socket descriptor var hints:addrinfo = new addrinfo(); var servinfo:addrinfo; hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; // use my IP var eaierr:CEAIrror = new CEAIrror(); var addrlist:Array = getaddrinfo( null, PORT, hints, eaierr ); if( !addrlist ) { throw eaierr; } var option:int; var bound:int; // loop through all the results and bind to the first we can for( var i:uint = 0; i < addrlist.length; i++ ) { servinfo = addrlist[i]; sockfd = socket( servinfo.ai_family, servinfo.ai_socktype, servinfo.ai_protocol ); if( sockfd == -1 ) { trace( "selectserver: socket" ) trace( new CError( "", errno ) ); continue; } option = setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR, 1 ); if( option == -1 ) { trace( "setsockopt" ); trace( new CError( "", errno ) ); exit( 1 ); } bound = bind( sockfd, servinfo.ai_addr ); if( bound == -1 ) { close( sockfd ); trace( "selectserver: bind" ); trace( new CError( "", errno ) ); continue; } break; } if( servinfo == null ) { trace( "selectserver: failed to bind" ); exit( 1 ); } var listening:int = listen( sockfd, BACKLOG ); if( listening == -1 ) { trace( "listen" ); trace( new CError( "", errno ) ); exit( 1 ); } trace( "selectserver: waiting for connections..." ); /* Note: so what is a select() server exactly ? it is simple - you use 'fd_set' to delcare sets of file descriptor (like an Array) - you use FD_SOMETHING macros to read/write/clear data from those sets FD_ZERO to reset a 'fd_set' FD_ISSET to know if a socket descriptor is set FD_SET to set a socket descriptor into a set FD_CLR to remove a socket descriptor from a set - then you use the function select() to loop trough all those sets And you know what, I messed up the implementation of select() "as is" it does not work or half-work, ok my bad but wait ... a 'fd_set' is like an array so you know what it's pretty simple to do like select() without select() simply put - add each new socket descriptor into an array - loop trough the array - detect if the socket is readable humm how to detect if a socket is readable ? well in C.sys.select.* you can find 3 functions isReadable() - Test if a socket is ready for reading. isWritable() - Test if a socket is ready for writing. isExceptional() - Test if a socket has an exceptional condition pending. and those are working :) (long sotry short strangely under the hood they alos use 'fd_set' but in a very simple stupid way that works) */ // reset the list var connections:Array = []; // add the listener to the master set connections.push( sockfd ); trace( "selectserver: server on socket " + sockfd ); var run:Boolean = true; /* Note: it can be a for(;;), a while(1), a while(true), etc. but yes you get it, here we need an infinite loop no worries it's Redtamarin, not Flash/AIR we can loop forever it will not cause a script timeout */ // main loop for(;;) { if( !run ) { break; } // run through the existing connections looking for data to read for( var j:uint = 0; j < connections.length; j++ ) { //trace( "selectserver: selecting socket " + connections[j] ); /* Note: if the socket descriptor is readable then we do our work ATTENTION in 'connections' you have both the server and all the clients - for the server being readable mean someone try to connect to the server and if no one try to connect then the server is not readable - for the client being readable mean the client try to send data to the server and if the client do nto send data then it is not readable so here the loop works like - loop trough all the socket descriptor - only do work if there is osmethign to read - if server, create a new connection - if client, read the client data - otherwise keep looping */ // we got one!! if( isReadable( connections[j] ) ) { // the server if( connections[j] == sockfd ) { // handle new connections var client_addr:sockaddr_in = new sockaddr_in(); new_fd = accept( sockfd, client_addr ); if( new_fd == -1 ) { trace( "accept" ); trace( new CError( "", errno ) ); } else { // add to master set connections.push( new_fd ); // keep track of the max /* Note: the array index does that for us */ var s:String = inet_ntop( client_addr.sin_family, client_addr ); trace( "selectserver: new connection from " + s + ", socket " + new_fd ); var msg_out:String = "Hello, world!\n"; var bytes_out:ByteArray = new ByteArray(); bytes_out.writeUTFBytes( msg_out ); bytes_out.position = 0; var sent:int = send( new_fd, bytes_out ); if( sent == -1 ) { trace( "send" ); trace( new CError( "", errno ) ); } else { trace( "sent " + sent + " bytes to the client " + new_fd ); } } } else { // handle data from a client var msg_in:String; var bytes_in:ByteArray = new ByteArray(); var received:int = recv( connections[j], bytes_in ); if( received <= 0 ) { // got error or connection closed by client if( received == 0 ) { // connection closed trace( "selectserver: socket " + connections[j] + " hung up" ); } else { trace( "recv" ); trace( new CError( "", errno ) ); } close( connections[j] ); // bye! // remove from master set connections.splice( j, 1 ); } else { // we got some data from a client trace( "received " + received + " bytes from client " + connections[j] ); bytes_in.position = 0; msg_in = bytes_in.readUTFBytes( bytes_in.length ); msg_in = msg_in.split( "\n" ).join( "" ); trace( connections[j] + " : " + msg_in ); if( msg_in == "shutdown" ) { trace( "selectserver: received 'shutdown' command" ); run = false; break; } } } // END handle data from client } // END got new incoming connection } // END looping through file descriptors } // END for(;;)--and you thought it would never end! trace( "selectserver: connections left [" + connections + "]" ); /* Note: properly close all clients before */ for( var k:uint = 0; k < connections.length; k++ ) { if( connections[k] != sockfd ) { trace( "selectserver: terminate " + connections[k] ); close( connections[k] ); connections.splice( k, 1 ); k = 0; //rewind } } trace( "shutting down server" ); shutdown( sockfd, SHUT_RDWR ); close( sockfd ); exit( 0 ); } } }
add basic select server
add basic select server git-svn-id: 44dac414ef660a76a1e627c7b7c0e36d248d62e4@17 c2cce57b-6cbb-4450-ba62-5fdab5196ef5
ActionScript
mpl-2.0
Corsaair/spitfire
216605b85eb27f245b3deca0af929f4d85bf6500
as3/com/netease/protobuf/ZigZag.as
as3/com/netease/protobuf/ZigZag.as
// vim: tabstop=4 shiftwidth=4 // Copyright (c) 2010 , 杨博 (Yang Bo) All rights reserved. // // [email protected] // // Use, modification and distribution are subject to the "New BSD License" // as listed at <url: http://www.opensource.org/licenses/bsd-license.php >. package com.netease.protobuf { public final class ZigZag { public static function encode32(n:int):int { return (n << 1) ^ (n >> 31) } public static function decode32(n:int):int { return (n >>> 1) ^ -(n & 1) } public static function encode64low(low:uint, high:int):uint { return (low << 1) ^ (high >> 31) } public static function encode64high(low:uint, high:int):int { return (low >>> 31) ^ (high << 1) ^ (high >> 31) } public static function decode64low(low:uint, high:int):uint { return (high << 31) ^ (low >>> 1) ^ -(low & 1) } public static function decode64high(low:uint, high:int):int { return (high >>> 1) ^ -(low & 1) } } }
添加遗漏的 ZigZag.as
添加遗漏的 ZigZag.as
ActionScript
bsd-2-clause
tconkling/protoc-gen-as3
6296149da3a24573e252886ac23521ee9fc7f296
src/flash/classes/ghost/helpers/Slider2D.as
src/flash/classes/ghost/helpers/Slider2D.as
/* ---------------------------------------------------------------------------- Ghost Comps is a set of controls to manipulate user interface objects. Copyright (C) 2010 Jan Cássio --------------------------------------------------------------------------- This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Ghost Comps Project http://github.com/jancassio/ghostcomps/ ------------------------------------------------------------------------ */ package ghost.helpers { import ghost.events.SliderEvent; import flash.events.EventDispatcher; import flash.geom.Point; import flash.geom.Rectangle; [Event (name="sliderDrag", type="ghost.events.SliderEvent")] [Event (name="sliderDrop", type="ghost.events.SliderEvent")] [Event (name="sliderUpdate", type="ghost.events.SliderEvent")] /** * Helper to assist in slider based interactions/instructions. * * @example * <code> * * var slider : Slider2D; * var rect : Rectangle; * var point : Point; * * slider = new Slider; * rect = new Rectangle(0, 0, 100, 100); * point = new Point(50, 50); * * slider.area = rect; * slider.position = point; * * trace("percentage x over area is: ", slider.percentageX); // .5; * slider.percentageY = .2; * trace("position Y over area is: ", slider.positionY); // 20; * </code> * * @author jancassio | [email protected] */ public class Slider2D extends EventDispatcher { /** lock x axis */ public static const HORIZONTAL : String = "horizontal"; /** lock y axis */ public static const VERTICAL : String = "vertical"; private var _pos : Point; private var _area : Rectangle; private var _axis : String; /** * Creates a new Slider2D instance. */ public function Slider2D ( area : Rectangle = null, position : Point = null, percentage : Point = null, axis : String = null ) { conf( area != null ? area.clone() : new Rectangle, position != null ? position.clone() : new Point, axis ); } protected function conf (area : Rectangle, point : Point, axis : String) : void { this._area = area; this._pos = point; this._axis = axis; } /** * The point x and y position. */ public function set position (value : Point):void { _pos.x = Math.max( _area.x, Math.min(_area.width + _area.x, value.x) ); _pos.y = Math.max( _area.y, Math.min(_area.height + _area.y, value.y) ); dispatch(SliderEvent.UPDATE); } /** * The x axis position. */ public function set positionX (value : Number):void { position = new Point( value, positionY ); } /** * The y axis position. */ public function set positionY (value : Number) : void { position = new Point( positionX, value ); } public function get position () : Point { return _pos.clone(); } public function get positionX () : Number { return _pos.x; } public function get positionY () : Number { return _pos.y; } /** * The point position percentage over area. */ public function set percentage (value : Point):void { position = new Point( _area.x + (_area.width * value.x), _area.y + (_area.height * value.y) ); dispatch(SliderEvent.UPDATE); } /** * The x axis slide percentage over area position. */ public function set percentageX (value : Number):void { percentage = new Point( value, percentageY ); } /** * The y axis slide percentage over area position. */ public function set percentageY (value : Number) : void { percentage = new Point( percentageX, value ); } public function get percentage () : Point { var x : Number; var y : Number; x = (position.x - _area.x) / _area.width; y = (position.y - _area.y) / _area.height; x = isNaN(x) ? 1 : x; y = isNaN(y) ? 1 : y; return new Point( x, y ); } public function get percentageX () : Number { return percentage.x; } public function get percentageY () : Number { return percentage.y; } /** * Slider area. */ public function set area (rectangle : Rectangle) : void { var oldPct : Point; oldPct = percentage.clone(); _area = rectangle.clone(); if(_axis != null) { if(_axis == HORIZONTAL) _area.height = 0; if(_axis == VERTICAL) _area.width = 0; } percentage = oldPct; } public function get area () : Rectangle { return _area.clone(); } /** * Active axis on slider. */ public function set axis (value : String) : void { _axis = value; } public function get axis () : String { return _axis; } /** * The x, y Point offset. */ public function get offset () : Point { var x : Number; var y : Number; x = (_pos.x - _area.x); y = (_pos.y - _area.y); return new Point( x, y ); } /** * Disposes object. */ public function dispose () : void { _pos = undefined; _area = undefined; _axis = undefined; } internal function dispatch(type : String):Boolean { var event : SliderEvent; event = new SliderEvent( type ); event.percentage = percentage; event.position = position; event.offset = offset; event.area = area; return dispatchEvent( event ); } } }
add ghost slider helper class
add ghost slider helper class
ActionScript
lgpl-2.1
jancassio/ghostcomps
e195e71bfd07ce31a21686d68bea67f9faeaf121
krew-framework/krewfw/builtin_actor/system/KrewScenarioPlayer.as
krew-framework/krewfw/builtin_actor/system/KrewScenarioPlayer.as
package krewfw.builtin_actor.system { import krewfw.core.KrewActor; /** * Base class for event-driven command player. */ //------------------------------------------------------------ public class KrewScenarioPlayer extends KrewActor { private var _eventList:Array; private var _eventsByTrigger:Object; private var _triggers:Object = {}; private var _methods:Object = {}; //------------------------------------------------------------ public function KrewScenarioPlayer() { displayable = false; } protected override function onDispose():void { _eventList = null; _eventsByTrigger = null; _triggers = null; _methods = null; } //------------------------------------------------------------ // public //------------------------------------------------------------ /** * @params eventList Example: * <pre> * [ * { * "trigger_key" : "start_turn", * "trigger_params": {"turn": 1}, * "method": "dialog", * "params": { * "messages": [ ... ] * }, * "next": [ * { * "method": "overlay", * "params": { ... } * } * ] * }, * ... * ] * </pre> */ public function setData(eventList:Array):void { _eventList = eventList; _eventsByTrigger = {}; for each (var eventData:Object in _eventList) { var triggerKey:String = eventData.trigger_key; if (!triggerKey) { continue; } if (!_eventsByTrigger[triggerKey]) { _eventsByTrigger[triggerKey] = []; } _eventsByTrigger[triggerKey].push(eventData); } } /** * @param checker Schema: function(eventArgs;Object, triggerParams:Object):Boolean */ public function addTrigger(triggerKey:String, eventName:String, checker:Function):void { _triggers[triggerKey] = new TriggerInfo(eventName, checker); } /** * @param triggerInfoList Example: * <pre> * [ * ["triggerKey", "eventName", checkerFunc], * ... * ] * </pre> */ public function addTriggers(triggerInfoList:Array):void { for each (var info:Array in triggerInfoList) { addTrigger(info[0], info[1], info[2]); } } /** * @param handler Schema: function(params:Object, onComplete:Function):void */ public function addMethod(methodName:String, handler:Function):void { _methods[methodName] = handler; } /** * @param triggerInfoList Example: * <pre> * [ * ["methodName", methodFunc], * ... * ] * </pre> */ public function addMethods(methodList:Array):void { for each (var info:Array in methodList) { addMethod(info[0], info[1]); } } /** * Activate player. * Please call this after setData(), addTriggers(), addMethods(), and init(). */ public function activate():void { for (var triggerKey:String in _eventsByTrigger) { _listenEvent(triggerKey); } } //------------------------------------------------------------ // private //------------------------------------------------------------ private function _listenEvent(triggerKey:String):void { var info:TriggerInfo = _triggers[triggerKey]; if (!info) { throw new Error('[KrewEventPlayer] trigger not registered: ' + triggerKey); return; } listen(info.eventName, function(eventArgs:Object):void { for each (var eventData:Object in _eventsByTrigger[triggerKey]) { var triggerParams:Object = eventData.trigger_params; if (!info.checker(eventArgs, triggerParams)) { continue; } _callMethod(eventData); } }); } private function _callMethod(eventData:Object):void { var methodName:String = eventData.method; if (!methodName) { throw new Error('[KrewEventPlayer] method name not found. (trigger: ' + eventData.trigger_key + ')'); return; } var method:Function = _methods[methodName]; if (method == null) { throw new Error('[KrewEventPlayer] method not registered: ' + methodName); return; } method(eventData.params, function():void { _callNextMethod(eventData); }); } private function _callNextMethod(parentEventData:Object):void { if (!parentEventData.next) { return; } for each (var nextEventData:Object in parentEventData.next) { _callMethod(nextEventData); } } } } class TriggerInfo { public var eventName:String; public var checker:Function; public function TriggerInfo(eventName:String, checker:Function) { this.eventName = eventName; this.checker = checker; } }
Add KrewScenarioPlayer
Add KrewScenarioPlayer
ActionScript
mit
tatsuya-koyama/krewFramework,tatsuya-koyama/krewFramework,tatsuya-koyama/krewFramework
7a75be2a482ff7e7e299d72707af4b3683ecddd9
dolly-framework/src/test/actionscript/dolly/CopyingOfNotCopyableSubclassTest.as
dolly-framework/src/test/actionscript/dolly/CopyingOfNotCopyableSubclassTest.as
package dolly { import dolly.core.dolly_internal; import dolly.data.NotCopyableSubclass; import org.as3commons.reflect.Field; import org.as3commons.reflect.Type; import org.flexunit.asserts.assertEquals; import org.flexunit.asserts.assertFalse; import org.flexunit.asserts.assertNotNull; use namespace dolly_internal; public class CopyingOfNotCopyableSubclassTest { private var notCopyableSubclass:NotCopyableSubclass; private var notCopyableSubclassType:Type; [Before] public function before():void { notCopyableSubclass = new NotCopyableSubclass(); notCopyableSubclass.property1 = "property1 value"; notCopyableSubclass.property2 = "property2 value"; notCopyableSubclass.writableField1 = "writableField1 value"; notCopyableSubclass.writableField2 = "writableField2 value"; notCopyableSubclassType = Type.forInstance(notCopyableSubclass); } [After] public function after():void { notCopyableSubclass = null; notCopyableSubclassType = null; } [Test] public function findingAllCopyableFieldsForType():void { const copyableFields:Vector.<Field> = Copier.findCopyableFieldsForType(notCopyableSubclassType); assertNotNull(copyableFields); assertEquals(2, copyableFields.length); assertNotNull(copyableFields[0]); assertNotNull(copyableFields[1]); } [Test] public function copyingByCopier():void { const copyInstance:NotCopyableSubclass = Copier.copy(notCopyableSubclass); assertNotNull(copyInstance); assertNotNull(copyInstance.property1); assertEquals(copyInstance.property1, notCopyableSubclass.property1); assertNotNull(copyInstance.property2); assertFalse(copyInstance.property2 == notCopyableSubclass.property2); assertNotNull(copyInstance.writableField1); assertEquals(copyInstance.writableField1, notCopyableSubclass.writableField1); assertNotNull(copyInstance.writableField2); assertFalse(copyInstance.writableField2 == notCopyableSubclass.writableField2); } [Test] public function copyingByCopyFunction():void { const copyInstance:NotCopyableSubclass = copy(notCopyableSubclass); assertNotNull(copyInstance); assertNotNull(copyInstance.property1); assertEquals(copyInstance.property1, notCopyableSubclass.property1); assertNotNull(copyInstance.property2); assertFalse(copyInstance.property2 == notCopyableSubclass.property2); assertNotNull(copyInstance.writableField1); assertEquals(copyInstance.writableField1, notCopyableSubclass.writableField1); assertNotNull(copyInstance.writableField2); assertFalse(copyInstance.writableField2 == notCopyableSubclass.writableField2); } } }
Create new test class CopyingOfNotCopyableSubclassTest for testing of creation copies for NotCopyableSubclass.
Create new test class CopyingOfNotCopyableSubclassTest for testing of creation copies for NotCopyableSubclass.
ActionScript
mit
Yarovoy/dolly
3bf988d40c913aa615bd66aef9432b11ecb08a42
src/main/actionscript/com/dotfold/dotvimstat/view/animation/ElementAnimationSequencer.as
src/main/actionscript/com/dotfold/dotvimstat/view/animation/ElementAnimationSequencer.as
package com.dotfold.dotvimstat.view.animation { import com.greensock.TweenLite; import flash.display.DisplayObject; import flash.events.Event; import flash.events.EventDispatcher; import flash.utils.setTimeout; /** * Sequence the alpha animation of a list of DisplayObject. * * @author jamesmcnamee * */ public class ElementAnimationSequencer extends EventDispatcher { private var _queue:Array; /** * Constructor. */ public function ElementAnimationSequencer() { super(); _queue = []; } /** * Adds a <code>DisplayObject</code> to the sequence. * * @param element DisplayObject to add to sequence. * @return this for chaining * */ public function addElement(element:DisplayObject):ElementAnimationSequencer { _queue.push(element); return this; } /** * Starts the sequence. */ public function play():void { animateNext(); } /** * Animate the next item in the sequence, is called recursively after * a delay until the queue is empty. */ private function animateNext():void { var next:DisplayObject = _queue.shift(); if (next) { TweenLite.to(next, 0.4, { alpha: 1, delay: 0.3} ); setTimeout(animateNext, 0.3); } else { dispatchEvent(new Event(Event.COMPLETE)); } } } }
add animation sequencer
[feat] add animation sequencer - create an abstracted animation sequencer for display objects
ActionScript
mit
dotfold/dotvimstat
521eef4295dc83ff008675515a53bb36539143af
src/battlecode/world/signals/RobotInfoSignal.as
src/battlecode/world/signals/RobotInfoSignal.as
package battlecode.world.signals { import battlecode.common.AttackType; import battlecode.common.MapLocation; public class RobotInfoSignal implements Signal { private var robotID:uint; private var health:Number; public function RobotInfoSignal(robotID:uint, health:Number) { this.robotID = robotID; this.health = health; } public function getRobotID():uint { return robotID; } public function getHealth():Number { return health; } public function accept(handler:SignalHandler):* { return handler.visitRobotInfoSignal(this); } } }
add missing file
add missing file
ActionScript
mit
trun/battlecode-webclient
cdd48f06336ce02f059dffe3265311733c512c1b
HLSPlugin/src/util/Hex.as
HLSPlugin/src/util/Hex.as
/** * Hex * * Utility class to convert Hex strings to ByteArray or String types. * Copyright (c) 2007 Henri Torgemane * * See LICENSE.txt for full license information. */ package util { import flash.utils.ByteArray; public class Hex { /** * Support straight hex, or colon-laced hex. * (that means 23:03:0e:f0, but *NOT* 23:3:e:f0) * Whitespace characters are ignored. */ public static function toArray(hex:String):ByteArray { hex = hex.replace(/\s|:/gm,''); var a:ByteArray = new ByteArray; if (hex.length&1==1) hex="0"+hex; for (var i:uint=0;i<hex.length;i+=2) { a[i/2] = parseInt(hex.substr(i,2),16); } return a; } public static function fromArray(array:ByteArray, colons:Boolean=false):String { var s:String = ""; for (var i:uint=0;i<array.length;i++) { s+=("0"+array[i].toString(16)).substr(-2,2); if (colons) { if (i<array.length-1) s+=":"; } } return s; } /** * * @param hex * @return a UTF-8 string decoded from hex * */ public static function toString(hex:String):String { var a:ByteArray = toArray(hex); return a.readUTFBytes(a.length); } /** * * @param str * @return a hex string encoded from the UTF-8 string str * */ public static function fromString(str:String, colons:Boolean=false):String { var a:ByteArray = new ByteArray; a.writeUTFBytes(str); return fromArray(a, colons); } } }
Add hex tool
Add hex tool
ActionScript
isc
mruse/osmf-hls-plugin,mruse/osmf-hls-plugin,denivip/osmf-hls-plugin,denivip/osmf-hls-plugin
42086ede23bdc4b99ddbcbcbdd0b3d03bd274fc5
src/aerys/minko/render/material/phong/AmbientShader.as
src/aerys/minko/render/material/phong/AmbientShader.as
package aerys.minko.render.material.phong { import aerys.minko.render.RenderTarget; import aerys.minko.render.material.basic.BasicShader; import aerys.minko.render.shader.SFloat; import aerys.minko.render.shader.ShaderSettings; import aerys.minko.render.shader.part.phong.PhongShaderPart; import aerys.minko.type.enum.Blending; public class AmbientShader extends BasicShader { private var _phong : PhongShaderPart; public function AmbientShader(renderTarget : RenderTarget = null, priority : Number = 0.0) { super(renderTarget, priority); _phong = new PhongShaderPart(this); } override protected function initializeSettings(settings:ShaderSettings):void { super.initializeSettings(settings); settings.blending = Blending.OPAQUE; } override protected function getPixelColor() : SFloat { var diffuse : SFloat = super.getPixelColor(); return float4(multiply(diffuse.rgb, _phong.getAmbientLighting()), diffuse.a); } } }
add missing AmbientShader
add missing AmbientShader
ActionScript
mit
aerys/minko-as3
cf4faf0135c23e7821b5f8b54a7da01ce50c4447
src/flash/ZeroClipboard.as
src/flash/ZeroClipboard.as
package { import flash.display.Stage; import flash.display.Sprite; import flash.display.LoaderInfo; import flash.display.StageScaleMode; import flash.events.*; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.external.ExternalInterface; import flash.system.Security; import flash.utils.*; import flash.system.System; public class ZeroClipboard extends Sprite { private var button:Sprite; private var clipText:String = ''; public function ZeroClipboard() { // constructor, setup event listeners and external interfaces stage.align = "TL"; stage.scaleMode = "noScale"; flash.system.Security.allowDomain("*"); // import flashvars var flashvars:Object = LoaderInfo( this.root.loaderInfo ).parameters; // invisible button covers entire stage button = new Sprite(); button.buttonMode = true; button.useHandCursor = true; button.graphics.beginFill(0xCCFF00); button.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight); button.alpha = 0.0; addChild(button); button.addEventListener(MouseEvent.CLICK, function(event:Event): void { // user click copies text to clipboard // as of flash player 10, this MUST happen from an in-movie flash click event System.setClipboard( clipText ); ExternalInterface.call( 'ZeroClipboard.dispatch', 'complete', clipText ); }); button.addEventListener(MouseEvent.MOUSE_OVER, function(event:Event): void { ExternalInterface.call( 'ZeroClipboard.dispatch', 'mouseOver', null ); } ); button.addEventListener(MouseEvent.MOUSE_OUT, function(event:Event): void { ExternalInterface.call( 'ZeroClipboard.dispatch', 'mouseOut', null ); } ); button.addEventListener(MouseEvent.MOUSE_DOWN, function(event:Event): void { ExternalInterface.call( 'ZeroClipboard.dispatch', 'mouseDown', null ); } ); button.addEventListener(MouseEvent.MOUSE_UP, function(event:Event): void { ExternalInterface.call( 'ZeroClipboard.dispatch', 'mouseUp', null ); } ); // external functions ExternalInterface.addCallback("setHandCursor", setHandCursor); ExternalInterface.addCallback("setText", setText); ExternalInterface.addCallback("setSize", setSize); // signal to the browser that we are ready ExternalInterface.call( 'ZeroClipboard.dispatch', 'load', null ); } public function setText(newText:String): void { // set the maximum number of files allowed clipText = newText; } public function setHandCursor(enabled:Boolean): void { // control whether the hand cursor is shown on rollover (true) // or the default arrow cursor (false) button.useHandCursor = enabled; } } }
package { import flash.display.Stage; import flash.display.Sprite; import flash.display.LoaderInfo; import flash.display.StageScaleMode; import flash.events.*; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.external.ExternalInterface; import flash.system.Security; import flash.utils.*; import flash.system.System; public class ZeroClipboard extends Sprite { private var button:Sprite; private var clipText:String = ''; public function ZeroClipboard() { // constructor, setup event listeners and external interfaces stage.align = "TL"; stage.scaleMode = "noScale"; flash.system.Security.allowDomain("*"); // import flashvars var flashvars:Object = LoaderInfo( this.root.loaderInfo ).parameters; // invisible button covers entire stage button = new Sprite(); button.buttonMode = true; button.useHandCursor = true; button.graphics.beginFill(0xCCFF00); button.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight); button.alpha = 0.0; addChild(button); button.addEventListener(MouseEvent.CLICK, function(event:Event): void { // user click copies text to clipboard // as of flash player 10, this MUST happen from an in-movie flash click event System.setClipboard( clipText ); ExternalInterface.call( 'ZeroClipboard.dispatch', 'complete', clipText ); }); button.addEventListener(MouseEvent.MOUSE_OVER, function(event:Event): void { ExternalInterface.call( 'ZeroClipboard.dispatch', 'mouseOver', null ); } ); button.addEventListener(MouseEvent.MOUSE_OUT, function(event:Event): void { ExternalInterface.call( 'ZeroClipboard.dispatch', 'mouseOut', null ); } ); button.addEventListener(MouseEvent.MOUSE_DOWN, function(event:Event): void { ExternalInterface.call( 'ZeroClipboard.dispatch', 'mouseDown', null ); } ); button.addEventListener(MouseEvent.MOUSE_UP, function(event:Event): void { ExternalInterface.call( 'ZeroClipboard.dispatch', 'mouseUp', null ); } ); // external functions ExternalInterface.addCallback("setHandCursor", setHandCursor); ExternalInterface.addCallback("setText", setText); ExternalInterface.addCallback("setSize", setSize); // signal to the browser that we are ready ExternalInterface.call( 'ZeroClipboard.dispatch', 'load', null ); } public function setText(newText:String): void { // set the maximum number of files allowed clipText = newText; } public function setHandCursor(enabled:Boolean): void { // control whether the hand cursor is shown on rollover (true) // or the default arrow cursor (false) button.useHandCursor = enabled; } public function setSize(width:Number, height:Number): void { button.width = width; button.height = height; } } }
Add a setSize function to the object
Add a setSize function to the object
ActionScript
mit
blackgirl/zeroclipboard,hallvors/zeroclipboard,sktguha/zeroclipboard,xqy/zeroclipboard,manfer/zeroclipboard,thinkerchan/zeroclipboard,jmgore75/clipandfile,weiland/zeroclipboard,zeroclipboard/ZeroClipboard,hallvors/zeroclipboard,zeroclipboard/ZeroClipboard,JamesMGreene/zeroclipboard,GerHobbelt/zeroclipboard,2947721120/zeroclipboard,thinkerchan/zeroclipboard,blackgirl/zeroclipboard,GerHobbelt/zeroclipboard,netizen0911/zeroclipboard,sktguha/zeroclipboard,xiexingen/zeroclipboard,justintung/zeroclipboard,PeterDaveHello/zeroclipboard,zeroclipboard/zeroclipboard,justintung/zeroclipboard,Satanpit/zeroclipboard,xqy/zeroclipboard,JamesMGreene/zeroclipboard,zeroclipboard/zeroclipboard,rogeriopradoj/zero-clipboard-composer,2947721120/zeroclipboard,netizen0911/zeroclipboard,Satanpit/zeroclipboard,manfer/zeroclipboard,ropik/zeroclipboard,xiexingen/zeroclipboard,jmgore75/clipandfile,qinhua/zeroclipboard,qinhua/zeroclipboard,PeterDaveHello/zeroclipboard,weiland/zeroclipboard
04bcf3dd0f63f534b0c169c7d943b939149bd32c
generator/sources/as3/com/kaltura/delegates/WebDelegateBase.as
generator/sources/as3/com/kaltura/delegates/WebDelegateBase.as
// =================================================================================================== // _ __ _ _ // | |/ /__ _| | |_ _ _ _ _ __ _ // | ' </ _` | | _| || | '_/ _` | // |_|\_\__,_|_|\__|\_,_|_| \__,_| // // This file is part of the Kaltura Collaborative Media Suite which allows users // to do with audio, video, and animation what Wiki platfroms allow them to do with // text. // // Copyright (C) 2006-2011 Kaltura Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // // @ignore // =================================================================================================== package com.kaltura.delegates { import com.kaltura.config.IKalturaConfig; import com.kaltura.config.KalturaConfig; import com.kaltura.core.KClassFactory; import com.kaltura.encryption.MD5; import com.kaltura.errors.KalturaError; import com.kaltura.events.KalturaEvent; import com.kaltura.net.KalturaCall; import flash.events.ErrorEvent; import flash.events.Event; import flash.events.EventDispatcher; import flash.events.HTTPStatusEvent; import flash.events.IOErrorEvent; import flash.events.SecurityErrorEvent; import flash.events.TimerEvent; import flash.net.FileReference; import flash.net.URLLoader; import flash.net.URLLoaderDataFormat; import flash.net.URLRequest; import flash.net.URLRequestMethod; import flash.utils.Timer; import flash.utils.getDefinitionByName; public class WebDelegateBase extends EventDispatcher implements IKalturaCallDelegate { public static var CONNECT_TIME:int = 60000; //60 secs public static var LOAD_TIME:int = 120000; //120 secs protected var connectTimer:Timer; protected var loadTimer:Timer; protected var _call:KalturaCall; protected var _config:KalturaConfig; protected var loader:URLLoader; protected var fileRef:FileReference; //Setters & getters public function get call():KalturaCall { return _call; } public function set call(newVal:KalturaCall):void { _call = newVal; } public function get config():IKalturaConfig { return _config; } public function set config(newVal:IKalturaConfig):void { _config = newVal as KalturaConfig; } public function WebDelegateBase(call:KalturaCall = null, config:KalturaConfig = null) { this.call = call; this.config = config; if (!call) return; //maybe a multi request if (call.useTimeout) { connectTimer = new Timer(CONNECT_TIME, 1); connectTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onConnectTimeout); loadTimer = new Timer(LOAD_TIME, 1); loadTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onLoadTimeOut); } execute(); } public function close():void { try { loader.close(); } catch (e:*) { } if (call.useTimeout) { connectTimer.stop(); loadTimer.stop(); } } protected function onConnectTimeout(event:TimerEvent):void { var kError:KalturaError = new KalturaError(); kError.errorCode = "CONNECTION_TIMEOUT"; kError.errorMsg = "Connection Timeout: " + CONNECT_TIME / 1000 + " sec with no post command from kaltura client."; _call.handleError(kError); dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); loadTimer.stop(); close(); } protected function onLoadTimeOut(event:TimerEvent):void { connectTimer.stop(); close(); var kError:KalturaError = new KalturaError(); kError.errorCode = "POST_TIMEOUT"; kError.errorMsg = "Post Timeout: " + LOAD_TIME / 1000 + " sec with no post result."; _call.handleError(kError); dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); } protected function execute():void { if (call == null) { throw new Error('No call defined.'); } post(); //post the call } /** * Helper function for sending the call straight to the server */ protected function post():void { addOptionalArguments(); formatRequest(); sendRequest(); if (call.useTimeout) { connectTimer.start(); } } protected function formatRequest():void { //The configuration is stronger then the args if (_config.partnerId != null && _call.args["partnerId"] == -1) _call.setRequestArgument("partnerId", _config.partnerId); if (_config.ks != null) _call.setRequestArgument("ks", _config.ks); if (_config.clientTag != null) _call.setRequestArgument("clientTag", _config.clientTag); _call.setRequestArgument("ignoreNull", _config.ignoreNull); //Create signature hash. //call.setRequestArgument("kalsig", getMD5Checksum(call)); } protected function getMD5Checksum(call:KalturaCall):String { var props:Array = new Array(); for each (var prop:String in call.args) props.push(prop); props.push("service"); props.push("action"); props.sort(); var s:String; for each (prop in props) { s += prop; if (prop == "service") s += call.service; else if (prop == "action") s += call.action; else s += call.args[prop]; } return MD5.encrypt(s); } protected function sendRequest():void { //construct the loader createURLLoader(); //Create signature hash. var kalsig:String = getMD5Checksum(call); //create the service request for normal calls var url:String = _config.protocol + _config.domain + "/" + _config.srvUrl + "?service=" + call.service + "&action=" + call.action + "&kalsig=" + kalsig;; if (_call.method == URLRequestMethod.GET) url += "&"; var req:URLRequest = new URLRequest(url); req.contentType = "application/x-www-form-urlencoded"; req.method = call.method; req.data = call.args; loader.dataFormat = URLLoaderDataFormat.TEXT; loader.load(req); } protected function createURLLoader():void { loader = new URLLoader(); loader.addEventListener(Event.COMPLETE, onDataComplete); loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus); loader.addEventListener(IOErrorEvent.IO_ERROR, onError); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError); loader.addEventListener(Event.OPEN, onOpen); } protected function onHTTPStatus(event:HTTPStatusEvent):void { } protected function onOpen(event:Event):void { if (call.useTimeout) { connectTimer.stop(); loadTimer.start(); } } protected function addOptionalArguments():void { //add optional args here } // Event Handlers /** * try to process received data. * if procesing failed, let call handle the processing error * @param event load complete event */ protected function onDataComplete(event:Event):void { try { handleResult(XML(event.target.data)); } catch (e:Error) { var kErr:KalturaError = new KalturaError(); kErr.errorCode = String(e.errorID); kErr.errorMsg = e.message; _call.handleError(kErr); } } /** * handle io or security error events from the loader. * create relevant KalturaError, let the call process it. * @param event */ protected function onError(event:ErrorEvent):void { clean(); var kError:KalturaError = createKalturaError(event, loader.data); if (!kError) { kError = new KalturaError(); kError.errorMsg = event.text; //kError.errorCode; } call.handleError(kError); dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); } /** * parse the server's response and let the call process it. * @param result server's response */ protected function handleResult(result:XML):void { clean(); var error:KalturaError = validateKalturaResponse(result); if (error == null) { var digestedResult:Object = parse(result); call.handleResult(digestedResult); } else { call.handleError(error); } } /** * stop timers and clean event listeners */ protected function clean():void { if (call.useTimeout) { connectTimer.stop(); loadTimer.stop(); } if (loader == null) { return; } loader.removeEventListener(Event.COMPLETE, onDataComplete); loader.removeEventListener(IOErrorEvent.IO_ERROR, onError); loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, onError); loader.removeEventListener(Event.OPEN, onOpen); } /** * create the correct object and populate it with the given values. if the needed class is not found * in the file, a generic object is created with attributes matching the XML attributes. * Override this parssing function in the specific delegate to create the correct object. * @param result instance attributes * @return an instance of the class declared by the given XML. * */ public function parse(result:XML):* { //by defualt create the response object var cls:Class; try { cls = getDefinitionByName('com.kaltura.vo.' + result.result.objectType) as Class; } catch (e:Error) { cls = Object; } var obj:* = (new KClassFactory(cls)).newInstanceFromXML(result.result); return obj; } /** * If the result string holds an error, return a KalturaError object with * relevant values. <br/> * Overide this to create validation object and fill it. * @param result the string returned from the server. * @return matching error object */ protected function validateKalturaResponse(result:String):KalturaError { var kError:KalturaError = null; var xml:XML = XML(result); if (xml.result.hasOwnProperty('error') && xml.result.error.hasOwnProperty('code') && xml.result.error.hasOwnProperty('message')) { kError = new KalturaError(); kError.errorCode = String(xml.result.error.code); kError.errorMsg = xml.result.error.message; dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); } return kError; } /** * create error object and fill it with relevant details * @param event * @param loaderData * @return detailed KalturaError to be processed */ protected function createKalturaError(event:ErrorEvent, loaderData:*):KalturaError { var ke:KalturaError = new KalturaError(); return ke; } /** * create the url that is used for serve actions * @param call the KalturaCall that defines the required parameters * @return URLRequest with relevant parameters * */ public function getServeUrl(call:KalturaCall):URLRequest { var url:String = _config.protocol + _config.domain + "/" + _config.srvUrl + "?service=" + call.service + "&action=" + call.action; for (var key:String in call.args) { url += "&" + key + "=" + call.args[key]; } var req:URLRequest = new URLRequest(url); req.contentType = "application/x-www-form-urlencoded"; req.method = call.method; // req.data = call.args; return req; } } }
// =================================================================================================== // _ __ _ _ // | |/ /__ _| | |_ _ _ _ _ __ _ // | ' </ _` | | _| || | '_/ _` | // |_|\_\__,_|_|\__|\_,_|_| \__,_| // // This file is part of the Kaltura Collaborative Media Suite which allows users // to do with audio, video, and animation what Wiki platfroms allow them to do with // text. // // Copyright (C) 2006-2011 Kaltura Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // // @ignore // =================================================================================================== package com.kaltura.delegates { import com.kaltura.config.IKalturaConfig; import com.kaltura.config.KalturaConfig; import com.kaltura.core.KClassFactory; import com.kaltura.encryption.MD5; import com.kaltura.errors.KalturaError; import com.kaltura.events.KalturaEvent; import com.kaltura.net.KalturaCall; import flash.events.ErrorEvent; import flash.events.Event; import flash.events.EventDispatcher; import flash.events.HTTPStatusEvent; import flash.events.IOErrorEvent; import flash.events.SecurityErrorEvent; import flash.events.TimerEvent; import flash.net.FileReference; import flash.net.URLLoader; import flash.net.URLLoaderDataFormat; import flash.net.URLRequest; import flash.net.URLRequestMethod; import flash.utils.Timer; import flash.utils.getDefinitionByName; public class WebDelegateBase extends EventDispatcher implements IKalturaCallDelegate { public static var CONNECT_TIME:int = 60000; //60 secs public static var LOAD_TIME:int = 120000; //120 secs protected var connectTimer:Timer; protected var loadTimer:Timer; protected var _call:KalturaCall; protected var _config:KalturaConfig; protected var loader:URLLoader; protected var fileRef:FileReference; //Setters & getters public function get call():KalturaCall { return _call; } public function set call(newVal:KalturaCall):void { _call = newVal; } public function get config():IKalturaConfig { return _config; } public function set config(newVal:IKalturaConfig):void { _config = newVal as KalturaConfig; } public function WebDelegateBase(call:KalturaCall = null, config:KalturaConfig = null) { this.call = call; this.config = config; if (!call) return; //maybe a multi request if (call.useTimeout) { connectTimer = new Timer(CONNECT_TIME, 1); connectTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onConnectTimeout); loadTimer = new Timer(LOAD_TIME, 1); loadTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onLoadTimeOut); } execute(); } public function close():void { try { loader.close(); } catch (e:*) { } if (call.useTimeout) { connectTimer.stop(); loadTimer.stop(); } } protected function onConnectTimeout(event:TimerEvent):void { var kError:KalturaError = new KalturaError(); kError.errorCode = "CONNECTION_TIMEOUT"; kError.errorMsg = "Connection Timeout: " + CONNECT_TIME / 1000 + " sec with no post command from kaltura client."; _call.handleError(kError); dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); loadTimer.stop(); close(); } protected function onLoadTimeOut(event:TimerEvent):void { connectTimer.stop(); close(); var kError:KalturaError = new KalturaError(); kError.errorCode = "POST_TIMEOUT"; kError.errorMsg = "Post Timeout: " + LOAD_TIME / 1000 + " sec with no post result."; _call.handleError(kError); dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); } protected function execute():void { if (call == null) { throw new Error('No call defined.'); } post(); //post the call } /** * Helper function for sending the call straight to the server */ protected function post():void { addOptionalArguments(); formatRequest(); sendRequest(); if (call.useTimeout) { connectTimer.start(); } } protected function formatRequest():void { //The configuration is stronger then the args if (_config.partnerId != null && _call.args["partnerId"] == -1) _call.setRequestArgument("partnerId", _config.partnerId); if (_config.ks != null) _call.setRequestArgument("ks", _config.ks); if (_config.clientTag != null) _call.setRequestArgument("clientTag", _config.clientTag); _call.setRequestArgument("ignoreNull", _config.ignoreNull); //Create signature hash. //call.setRequestArgument("kalsig", getMD5Checksum(call)); } protected function getMD5Checksum(call:KalturaCall):String { var props:Array = new Array(); for each (var prop:String in call.args) props.push(prop); props.push("service"); props.push("action"); props.sort(); var s:String; for each (prop in props) { s += prop; if (prop == "service") s += call.service; else if (prop == "action") s += call.action; else s += call.args[prop]; } return MD5.encrypt(s); } protected function sendRequest():void { //construct the loader createURLLoader(); //Create signature hash. var kalsig:String = getMD5Checksum(call); //create the service request for normal calls var url:String = _config.protocol + _config.domain + "/" + _config.srvUrl + "?service=" + call.service + "&action=" + call.action + "&kalsig=" + kalsig;; if (_call.method == URLRequestMethod.GET) url += "&"; var req:URLRequest = new URLRequest(url); req.contentType = "application/x-www-form-urlencoded"; req.method = call.method; req.data = call.args; loader.dataFormat = URLLoaderDataFormat.TEXT; loader.load(req); } protected function createURLLoader():void { loader = new URLLoader(); loader.addEventListener(Event.COMPLETE, onDataComplete); loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus); loader.addEventListener(IOErrorEvent.IO_ERROR, onError); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError); loader.addEventListener(Event.OPEN, onOpen); } protected function onHTTPStatus(event:HTTPStatusEvent):void { } protected function onOpen(event:Event):void { if (call.useTimeout) { connectTimer.stop(); loadTimer.start(); } } protected function addOptionalArguments():void { //add optional args here } // Event Handlers /** * try to process received data. * if procesing failed, let call handle the processing error * @param event load complete event */ protected function onDataComplete(event:Event):void { try { handleResult(XML(event.target.data)); } catch (e:Error) { var kErr:KalturaError = new KalturaError(); kErr.errorCode = String(e.errorID); kErr.errorMsg = e.message; _call.handleError(kErr); } } /** * handle io or security error events from the loader. * create relevant KalturaError, let the call process it. * @param event */ protected function onError(event:ErrorEvent):void { clean(); var kError:KalturaError = createKalturaError(event, loader.data); if (!kError) { kError = new KalturaError(); kError.errorMsg = event.text; //kError.errorCode; } call.handleError(kError); dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); } /** * parse the server's response and let the call process it. * @param result server's response */ protected function handleResult(result:XML):void { clean(); var error:KalturaError = validateKalturaResponse(result); if (error == null) { var digestedResult:Object = parse(result); call.handleResult(digestedResult); } else { call.handleError(error); } } /** * stop timers and clean event listeners */ protected function clean():void { if (call.useTimeout) { connectTimer.stop(); loadTimer.stop(); } if (loader == null) { return; } loader.removeEventListener(Event.COMPLETE, onDataComplete); loader.removeEventListener(IOErrorEvent.IO_ERROR, onError); loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, onError); loader.removeEventListener(Event.OPEN, onOpen); } /** * create the correct object and populate it with the given values. if the needed class is not found * in the file, a generic object is created with attributes matching the XML attributes. * Override this parssing function in the specific delegate to create the correct object. * @param result instance attributes * @return an instance of the class declared by the given XML. * */ public function parse(result:XML):* { //by defualt create the response object var cls:Class; try { cls = getDefinitionByName('com.kaltura.vo.' + result.result.objectType) as Class; } catch (e:Error) { cls = Object; } var obj:* = (new KClassFactory(cls)).newInstanceFromXML(result.result); return obj; } /** * If the result string holds an error, return a KalturaError object with * relevant values. <br/> * Overide this to create validation object and fill it. * @param result the string returned from the server. * @return matching error object */ protected function validateKalturaResponse(result:String):KalturaError { var kError:KalturaError = null; var xml:XML = XML(result); if (xml.result.hasOwnProperty('error') && xml.result.error.hasOwnProperty('code') && xml.result.error.hasOwnProperty('message')) { kError = new KalturaError(); kError.errorCode = String(xml.result.error.code); kError.errorMsg = xml.result.error.message; dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); } return kError; } /** * create error object and fill it with relevant details * @param event * @param loaderData * @return detailed KalturaError to be processed */ protected function createKalturaError(event:ErrorEvent, loaderData:*):KalturaError { var ke:KalturaError = new KalturaError(); ke.errorMsg = event.text; return ke; } /** * create the url that is used for serve actions * @param call the KalturaCall that defines the required parameters * @return URLRequest with relevant parameters * */ public function getServeUrl(call:KalturaCall):URLRequest { var url:String = _config.protocol + _config.domain + "/" + _config.srvUrl + "?service=" + call.service + "&action=" + call.action; for (var key:String in call.args) { url += "&" + key + "=" + call.args[key]; } var req:URLRequest = new URLRequest(url); req.contentType = "application/x-www-form-urlencoded"; req.method = call.method; // req.data = call.args; return req; } } }
add error event text to the KalturaError
qnd: add error event text to the KalturaError git-svn-id: 8a2ccb88241e16c78017770bc38d91d6d5396a5a@90711 6b8eccd3-e8c5-4e7d-8186-e12b5326b719
ActionScript
agpl-3.0
DBezemer/server,jorgevbo/server,DBezemer/server,DBezemer/server,DBezemer/server,gale320/server,gale320/server,DBezemer/server,ratliff/server,doubleshot/server,gale320/server,kaltura/server,kaltura/server,jorgevbo/server,ivesbai/server,matsuu/server,jorgevbo/server,ivesbai/server,gale320/server,jorgevbo/server,jorgevbo/server,DBezemer/server,gale320/server,jorgevbo/server,ivesbai/server,doubleshot/server,doubleshot/server,matsuu/server,ratliff/server,kaltura/server,ratliff/server,ratliff/server,ratliff/server,matsuu/server,ivesbai/server,gale320/server,ivesbai/server,doubleshot/server,doubleshot/server,ratliff/server,matsuu/server,kaltura/server,kaltura/server,kaltura/server,matsuu/server,matsuu/server,doubleshot/server,ratliff/server,ratliff/server,ivesbai/server,jorgevbo/server,gale320/server,doubleshot/server,ivesbai/server,DBezemer/server,jorgevbo/server,doubleshot/server,gale320/server,ivesbai/server,matsuu/server,matsuu/server,DBezemer/server
ae6d11469b78fd6d754dcd721a31c6ab981e0660
src/com/esri/builder/model/IConstraints.as
src/com/esri/builder/model/IConstraints.as
//////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2008-2013 Esri. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. //////////////////////////////////////////////////////////////////////////////// package com.esri.builder.model { public interface IConstraints { function get left():String; function set left(value:String):void; function get top():String; function set top(value:String):void; function get right():String; function set right(value:String):void; function get bottom():String; function set bottom(value:String):void; } }
Add IConstraints.
Add IConstraints.
ActionScript
apache-2.0
Esri/arcgis-viewer-builder-flex
a3d7a2c10d5b759af8f828c5ce5270a2cc23923b
examples/web/app/classes/server/FMSConnection.as
examples/web/app/classes/server/FMSConnection.as
package server { import flash.net.NetConnection; import flash.net.Responder; public final class FMSConnection extends NetConnection { public function FMSConnection(command:String = null, ...rest) { command && this.connect.apply(null, [command].concat(rest)); } public function dispose():void { this.close(); } override public function connect(command:String, ...rest):void { try { super.connect.apply(null, [command].concat(rest)); } catch (error:Error) { trace(this.toString(), 'Can\'t connect...the connection name is already being used by another SWF.'); } } override public function close():void { try { super.close(); } catch (error:Error) { trace(this.toString(), error.message); } } override public function call(command:String, responder:Responder, ...rest):void { super.call.apply(null, [command, responder].concat(rest)); } override public function toString():String { return '[FMSConnection]'; } } }
Create FMSConnection.as
Create FMSConnection.as
ActionScript
apache-2.0
adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler
8e1c569865b2727ffb9fb313b3540c3409c1a8c5
src/avm2/tests/regress/correctness/arrays.as
src/avm2/tests/regress/correctness/arrays.as
const count = 1024; function foo() { var a = []; for (var i = 0; i < count; i++) { a.push(i); } for (var j = 0; j < 1024; j++) { for (var i = 2; i < count; i++) { a[i] = a[i - 1] + a[i - 2]; } } trace(a.length); } foo();
const count = 16; function foo() { var a = []; for (var i = 0; i < count; i++) { a.push(i); } for (var j = 0; j < 1024; j++) { for (var i = 2; i < count; i++) { a[i] = a[i - 1] + a[i - 2]; } } trace(a.length); } foo();
Reduce test running time.
Reduce test running time.
ActionScript
apache-2.0
tschneidereit/shumway,tschneidereit/shumway,mbebenita/shumway,tschneidereit/shumway,tschneidereit/shumway,mbebenita/shumway,tschneidereit/shumway,yurydelendik/shumway,mbebenita/shumway,mbebenita/shumway,mozilla/shumway,mbebenita/shumway,tschneidereit/shumway,mozilla/shumway,mozilla/shumway,yurydelendik/shumway,tschneidereit/shumway,yurydelendik/shumway,mbebenita/shumway,mbebenita/shumway,yurydelendik/shumway,mbebenita/shumway,mozilla/shumway,yurydelendik/shumway,mozilla/shumway,mozilla/shumway,tschneidereit/shumway,yurydelendik/shumway,mozilla/shumway,yurydelendik/shumway,mozilla/shumway,yurydelendik/shumway
e1135623234d9ed3a2219690585c0679d28c87a9
static/vendors/ace-builds/demo/kitchen-sink/docs/actionscript.as
static/vendors/ace-builds/demo/kitchen-sink/docs/actionscript.as
package code { /***************************************** * based on textmate actionscript bundle ****************************************/ import fl.events.SliderEvent; public class Foo extends MovieClip { //************************* // Properties: public var activeSwatch:MovieClip; // Color offsets public var c1:Number = 0; // R //************************* // Constructor: public function Foo() { // Respond to mouse events swatch1_btn.addEventListener(MouseEvent.CLICK,swatchHandler,false,0,false); previewBox_btn.addEventListener(MouseEvent.MOUSE_DOWN,dragPressHandler); // Respond to drag events red_slider.addEventListener(SliderEvent.THUMB_DRAG,sliderHandler); // Draw a frame later addEventListener(Event.ENTER_FRAME,draw); } protected function clickHandler(event:MouseEvent):void { car.transform.colorTransform = new ColorTransform(0,0,0,1,c1,c2,c3); } protected function changeRGBHandler(event:Event):void { c1 = Number(c1_txt.text); if(!(c1>=0)){ c1 = 0; } updateSliders(); } } }
Update static/vendors/ace-builds/demo/kitchen-sink/docs/actionscript.as
Update static/vendors/ace-builds/demo/kitchen-sink/docs/actionscript.as Signed-off-by: Bernard Ojengwa <[email protected]>
ActionScript
mit
apipanda/openssl,apipanda/openssl,apipanda/openssl,apipanda/openssl
618e29e2ee38b958d93573b922f6fb671728af8f
frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ScrollingContainerView.as
frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ScrollingContainerView.as
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.html.beads { import flash.display.DisplayObject; import flash.display.DisplayObjectContainer; import org.apache.flex.core.BeadViewBase; import org.apache.flex.core.IBead; import org.apache.flex.core.IBeadView; import org.apache.flex.core.ILayoutParent; import org.apache.flex.core.IStrand; import org.apache.flex.core.IParent; import org.apache.flex.core.UIBase; import org.apache.flex.core.ValuesManager; import org.apache.flex.html.Container; import org.apache.flex.html.supportClasses.Border; import org.apache.flex.html.supportClasses.ContainerContentArea; import org.apache.flex.html.supportClasses.ScrollBar; import org.apache.flex.html.beads.models.ScrollBarModel; /** * The ContainerView class is the default view for * the org.apache.flex.html.Container class. * It lets you use some CSS styles to manage the border, background * and padding around the content area. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public class ScrollingContainerView extends BeadViewBase implements IBeadView, ILayoutParent { /** * Constructor. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function ScrollingContainerView() { } /** * The actual parent that parents the children. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ protected var actualParent:DisplayObjectContainer; /** * @copy org.apache.flex.core.IBead#strand * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ override public function set strand(value:IStrand):void { super.strand = value; var padding:Object = determinePadding(); if (contentAreaNeeded()) { actualParent = new ContainerContentArea(); DisplayObjectContainer(value).addChild(actualParent); Container(value).setActualParent(actualParent); actualParent.x = padding.paddingLeft; actualParent.y = padding.paddingTop; } else { actualParent = value as UIBase; } var backgroundColor:Object = ValuesManager.valuesImpl.getValue(value, "background-color"); var backgroundImage:Object = ValuesManager.valuesImpl.getValue(value, "background-image"); if (backgroundColor != null || backgroundImage != null) { if (value.getBeadByType(IBackgroundBead) == null) value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBackgroundBead")) as IBead); } var borderStyle:String; var borderStyles:Object = ValuesManager.valuesImpl.getValue(value, "border"); if (borderStyles is Array) { borderStyle = borderStyles[1]; } if (borderStyle == null) { borderStyle = ValuesManager.valuesImpl.getValue(value, "border-style") as String; } if (borderStyle != null && borderStyle != "none") { if (value.getBeadByType(IBorderBead) == null) value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead); } } /** * Determines the top and left padding values, if any, as set by * padding style values. This includes "padding" for all padding values * as well as "padding-left" and "padding-top". * * Returns an object with paddingLeft and paddingTop properties. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ protected function determinePadding():Object { var paddingLeft:Object; var paddingTop:Object; var padding:Object = ValuesManager.valuesImpl.getValue(_strand, "padding"); if (padding is Array) { if (padding.length == 1) paddingLeft = paddingTop = padding[0]; else if (padding.length <= 3) { paddingLeft = padding[1]; paddingTop = padding[0]; } else if (padding.length == 4) { paddingLeft = padding[3]; paddingTop = padding[0]; } } else if (padding == null) { paddingLeft = ValuesManager.valuesImpl.getValue(_strand, "padding-left"); paddingTop = ValuesManager.valuesImpl.getValue(_strand, "padding-top"); } else { paddingLeft = paddingTop = padding; } var pl:Number = Number(paddingLeft); var pt:Number = Number(paddingTop); return {paddingLeft:pl, paddingTop:pt}; } /** * Returns true if container to create a separate ContainerContentArea. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ protected function contentAreaNeeded():Boolean { var padding:Object = determinePadding(); return (!isNaN(padding.paddingLeft) && padding.paddingLeft > 0 || !isNaN(padding.paddingTop) && padding.paddingTop > 0); } /** * The parent of the children. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function get contentView():DisplayObjectContainer { return actualParent; } /** * The border. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function get border():Border { return null; } /** * The host component, which can resize to different slots. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function get resizableView():DisplayObject { return _strand as DisplayObject; } private var _vScrollBar:ScrollBar; /** * The vertical ScrollBar, if it exists. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function get vScrollBar():ScrollBar { if (!_vScrollBar) _vScrollBar = createScrollBar(); return _vScrollBar; } /** * The horizontal ScrollBar, if it exists. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function get hScrollBar():ScrollBar { return null; } /** * @private */ private function createScrollBar():ScrollBar { var vsb:ScrollBar; vsb = new ScrollBar(); var vsbm:ScrollBarModel = new ScrollBarModel(); vsbm.maximum = 100; vsbm.minimum = 0; vsbm.pageSize = 10; vsbm.pageStepSize = 10; vsbm.snapInterval = 1; vsbm.stepSize = 1; vsbm.value = 0; vsb.model = vsbm; vsb.width = 16; IParent(_strand).addElement(vsb); return vsb; } /** * The position of the vertical scrollbar * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function get verticalScrollPosition():Number { return ScrollBarModel(vScrollBar.model).value; } /** * @private */ public function set verticalScrollPosition(value:Number):void { ScrollBarModel(vScrollBar.model).value = value; } /** * The maximum position of the vertical scrollbar * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function get maxVerticalScrollPosition():Number { return ScrollBarModel(vScrollBar.model).maximum - ScrollBarModel(vScrollBar.model).pageSize; } } }
add a scrolling container view
add a scrolling container view
ActionScript
apache-2.0
greg-dove/flex-asjs,greg-dove/flex-asjs,greg-dove/flex-asjs,greg-dove/flex-asjs
bb683edd8590674e7121f71ddba48acb8b708b0a
skin-src/goplayer/debug.as
skin-src/goplayer/debug.as
package goplayer { public function debug(message : Object) { callJavascript("goplayer.log", message.toString()) } }
Add debug.as to skin-src.
Add debug.as to skin-src.
ActionScript
mit
dbrock/goplayer,dbrock/goplayer
bc887cc5f2b150ea567ae5bf2c65fbba2a7434bd
src/aerys/minko/render/material/vertex/VertexTangentShader.as
src/aerys/minko/render/material/vertex/VertexTangentShader.as
package aerys.minko.render.material.vertex { import aerys.minko.render.RenderTarget; import aerys.minko.render.material.basic.BasicShader; import aerys.minko.render.shader.SFloat; import aerys.minko.render.shader.Shader; public class VertexTangentShader extends BasicShader { private var _tangent : SFloat; public function VertexTangentShader(renderTarget : RenderTarget = null, priority : Number = 0.0) { super(renderTarget, priority); } override protected function getVertexPosition() : SFloat { _tangent = deltaLocalToWorld(vertexAnimation.getAnimatedVertexTangent()); _tangent = normalize(_tangent); _tangent = divide(add(_tangent, 1), 2); return super.getVertexPosition(); } override protected function getPixelColor() : SFloat { return float4(normalize(interpolate(_tangent.xyz)), 1); } } }
add VertexTangentShader to display per-pixel tangents
add VertexTangentShader to display per-pixel tangents
ActionScript
mit
aerys/minko-as3
25934b9a249f9567b014fa697a4a7717168721fe
src/aerys/minko/scene/controller/debug/JointsDebugController.as
src/aerys/minko/scene/controller/debug/JointsDebugController.as
package aerys.minko.scene.controller.debug { import aerys.minko.render.geometry.primitive.CubeGeometry; import aerys.minko.render.material.Material; import aerys.minko.render.material.basic.BasicMaterial; import aerys.minko.scene.controller.AbstractController; import aerys.minko.scene.node.Group; import aerys.minko.scene.node.Mesh; import aerys.minko.type.enum.DepthTest; import aerys.minko.type.math.Vector4; /** * Add debug meshes to see the joint and the bone described by a Group node. * This controller can be added to every joint of a skeleton to display it: * * <pre> * var debugCtrl : JointsDebugController = new JointsDebugController(); * * for each (var m : Mesh in result.get('//mesh[hasController(SkinningController)]')) * { * var skinningCtrl : SkinningController = m.getControllersByType(SkinningController)[0] * as SkinningController; * * for each (var joint : Group in skinningCtrl.joints) * if (joint.getControllersByType(JointsDebugController).length == 0) * joint.addController(debugCtrl); * } * </pre> * * To remove this controller, you can fetch all the group that have it and remove it from * their controllers: * * <pre> * for each (var node : ISceneNode in result.get('//group[hasController(JointsDebugController)]')) * node.removeController(debugCtrl); * </pre> * * @author Jean-Marc Le Roux * */ public final class JointsDebugController extends AbstractController { private var _jointsMaterial : Material; private var _bonesMaterial : Material; public function JointsDebugController(jointsMaterial : Material = null, bonesMaterial : Material = null) { super(Group); initialize(jointsMaterial, bonesMaterial); } private function initialize(jointsMaterial : Material, bonesMaterial : Material) : void { _jointsMaterial = jointsMaterial; if (!_jointsMaterial) { var jointsBasicMaterial : BasicMaterial = new BasicMaterial(); jointsBasicMaterial.diffuseColor = 0xff0000ff; jointsBasicMaterial.depthWriteEnabled = false; jointsBasicMaterial.depthTest = DepthTest.ALWAYS; _jointsMaterial = jointsBasicMaterial; } _bonesMaterial = bonesMaterial; if (!_bonesMaterial) { var bonesBasicMaterial : BasicMaterial = new BasicMaterial(); bonesBasicMaterial.diffuseColor = 0x00ff00ff; bonesBasicMaterial.depthWriteEnabled = false; bonesBasicMaterial.depthTest = DepthTest.ALWAYS; _bonesMaterial = bonesBasicMaterial; } targetAdded.add(targetAddedHandler); targetRemoved.add(targetRemovedHandler); } private function targetAddedHandler(ctrl : AbstractController, target : Group) : void { var numChildren : uint = target.numChildren; for (var i : uint = 0; i < numChildren; ++i) { var child : Group = target.getChildAt(i) as Group; if (child != null) { var nextJointPosition : Vector4 = child.transform.transformVector( Vector4.ZERO ); var boneLength : Number = nextJointPosition.length; var boneMesh : Mesh = new Mesh( CubeGeometry.cubeGeometry, _bonesMaterial, '__bone__' ); var jointMesh : Mesh = new Mesh( CubeGeometry.cubeGeometry, _jointsMaterial, '__joint__' ); jointMesh.transform.appendUniformScale(.08); target.addChild(jointMesh); if (boneLength != 0.) { boneMesh.transform .lookAt(nextJointPosition) .prependTranslation(0, 0, boneLength * .5) .prependScale(.02, .02, boneLength); target.addChild(boneMesh); } } } } private function targetRemovedHandler(ctrl : AbstractController, target : Group) : void { for each (var jointMesh : Mesh in target.get("/mesh[name='__joint__']")) jointMesh.parent = null; for each (var boneMesh : Mesh in target.get("/mesh[name='__bone__']")) boneMesh.parent = null; } } }
add JointsDebugController to display a Group as a joint/bone
add JointsDebugController to display a Group as a joint/bone
ActionScript
mit
aerys/minko-as3
15e360bce51438f8066d4aae063b6ee8ab92564c
mustella/as3/src/mustella/FakeSoftKeyboard.as
mustella/as3/src/mustella/FakeSoftKeyboard.as
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package { import flash.display.DisplayObject; import flash.display.InteractiveObject; import flash.display.Sprite; import flash.events.FocusEvent; import flash.events.SoftKeyboardEvent; import flash.events.SoftKeyboardTrigger; import flash.geom.Rectangle; import flash.text.TextField; import flash.utils.getQualifiedClassName; import mx.core.mx_internal; [Mixin] /** * A hash table of tests not to run. */ public class FakeSoftKeyboard { private static var kbdrect:QName = new QName(mx_internal, "_softKeyboardRect"); public static var portraitHeight:Number = 200; public static var landscapeHeight:Number = 150; /** * Mixin callback that checks if we're in the emulator * and tries to fake what would happen in terms of events * and sizing if you were on the device. It doesn't actually * need a useful UI since to type, you should just use * DispatchKeyEvent */ public static function init(root:DisplayObject):void { if (DeviceNames.getFromOS() == "") return; // not mac or win FakeSoftKeyboard.root = root; root.addEventListener(FocusEvent.FOCUS_IN, focusInHandler); root.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler); } public static var kbd:Sprite; public static var root:DisplayObject; public static function focusInHandler(event:FocusEvent):void { var comp:Object = event.target; if (comp is TextField || comp is InteractiveObject) { if (!(comp.needsSoftKeyboard || getQualifiedClassName(comp).indexOf("StyleableStageText") > 0)) return; if (!comp.dispatchEvent(new SoftKeyboardEvent(SoftKeyboardEvent.SOFT_KEYBOARD_ACTIVATING, true, true, event.relatedObject, SoftKeyboardTrigger.USER_TRIGGERED))) { root.stage.focus = null; return; } if (!kbd) { kbd = new Sprite(); kbd.graphics.beginFill(0x808080); kbd.graphics.drawRect(0, 0, 10, 10); kbd.graphics.endFill(); } // root is actually a systemManager root["popUpChildren"].addChild(kbd); if (root.stage.stageHeight > root.stage.stageWidth) { kbd.height = portraitHeight; kbd.width = root.stage.stageWidth; root["document"][kbdrect] = new Rectangle(0, 0, kbd.width, kbd.height); kbd.y = root.stage.stageHeight - portraitHeight; } else { kbd.height = landscapeHeight; kbd.width = root.stage.stageWidth; root["document"][kbdrect] = new Rectangle(0, 0, kbd.width, kbd.height); kbd.y = root.stage.stageHeight - landscapeHeight; } trace("sent softKeyboardActivate from", comp); comp.dispatchEvent(new SoftKeyboardEvent(SoftKeyboardEvent.SOFT_KEYBOARD_ACTIVATE, true, false, event.relatedObject, SoftKeyboardTrigger.USER_TRIGGERED)); } } public static function focusOutHandler(event:FocusEvent):void { trace("fakesoftkeyboard focusOut", event.target, event.relatedObject, kbd); if (kbd && kbd.parent) { // root is actually a systemManager root["popUpChildren"].removeChild(kbd); root["document"][kbdrect] = new Rectangle(0, 0, 0, 0); trace("sent softKeyboardDeactivate from", event.target); event.target.dispatchEvent(new SoftKeyboardEvent(SoftKeyboardEvent.SOFT_KEYBOARD_DEACTIVATE, true, false, event.relatedObject, SoftKeyboardTrigger.USER_TRIGGERED)); } } } }
Add helper to fake softkeyboard events on desktop runs.
Add helper to fake softkeyboard events on desktop runs. git-svn-id: f8d5f742b420a6a114b58659a4f85f335318e53c@1436779 13f79535-47bb-0310-9956-ffa450edef68
ActionScript
apache-2.0
SlavaRa/flex-sdk,shyamalschandra/flex-sdk,danteinforno/flex-sdk,apache/flex-sdk,adufilie/flex-sdk,SlavaRa/flex-sdk,SlavaRa/flex-sdk,apache/flex-sdk,danteinforno/flex-sdk,danteinforno/flex-sdk,SlavaRa/flex-sdk,adufilie/flex-sdk,apache/flex-sdk,apache/flex-sdk,adufilie/flex-sdk,shyamalschandra/flex-sdk,shyamalschandra/flex-sdk,SlavaRa/flex-sdk,adufilie/flex-sdk,adufilie/flex-sdk,danteinforno/flex-sdk,shyamalschandra/flex-sdk,danteinforno/flex-sdk,apache/flex-sdk,SlavaRa/flex-sdk,shyamalschandra/flex-sdk,apache/flex-sdk,adufilie/flex-sdk,shyamalschandra/flex-sdk,danteinforno/flex-sdk
99a38ecd34d375033c49ddcd70d09f40395caa84
dolly-framework/src/test/actionscript/dolly/CopyingOfCopyableClassTest.as
dolly-framework/src/test/actionscript/dolly/CopyingOfCopyableClassTest.as
package dolly { import dolly.core.dolly_internal; import dolly.data.CopyableClass; import org.as3commons.reflect.Field; import org.as3commons.reflect.Type; import org.flexunit.asserts.assertEquals; import org.flexunit.asserts.assertNotNull; use namespace dolly_internal; public class CopyingOfCopyableClassTest { private var copyableClass:CopyableClass; private var copyableClassType:Type; [Before] public function before():void { copyableClass = new CopyableClass(); copyableClass.property1 = "property1 value"; copyableClass.writableField1 = "writableField1 value"; copyableClassType = Type.forInstance(copyableClass); } [After] public function after():void { copyableClass = null; copyableClassType = null; } [Test] public function findingAllCopyableFieldsForType():void { const copyableFields:Vector.<Field> = Copier.findCopyableFieldsForType(copyableClassType); assertNotNull(copyableFields); assertEquals(2, copyableFields.length); assertNotNull(copyableFields[0]); assertNotNull(copyableFields[1]); } [Test] public function copyingByCopier():void { const copyInstance:CopyableClass = Copier.copy(copyableClass); assertNotNull(copyInstance); assertNotNull(copyInstance.property1); assertEquals(copyInstance.property1, copyableClass.property1); assertNotNull(copyInstance.writableField1); assertEquals(copyInstance.writableField1, copyableClass.writableField1); } [Test] public function copyingByCopyFunction():void { const copyInstance:CopyableClass = copy(copyableClass); assertNotNull(copyInstance); assertNotNull(copyInstance.property1); assertEquals(copyInstance.property1, copyableClass.property1); assertNotNull(copyInstance.writableField1); assertEquals(copyInstance.writableField1, copyableClass.writableField1); } } }
Create new test class CopyingOfCopyableClassTest for testing of creation copies of CopyableClass.
Create new test class CopyingOfCopyableClassTest for testing of creation copies of CopyableClass.
ActionScript
mit
Yarovoy/dolly
a69978a8b8c7af092154880189a3d30cdf3a3b90
src/avm2/tests/regress/correctness/pass/getQualifiedClassName.as
src/avm2/tests/regress/correctness/pass/getQualifiedClassName.as
package avmplus { import flash.utils.Dictionary; import flash.utils.getQualifiedClassName; trace(getQualifiedClassName("Hello")); trace(getQualifiedClassName(123)); trace(getQualifiedClassName(String)); trace(getQualifiedClassName([])); trace(getQualifiedClassName(Array)); trace(getQualifiedClassName(true)); trace(getQualifiedClassName(0)); class A {} trace(getQualifiedClassName(A)); trace(getQualifiedClassName(new A())); var values = [1, -1, "1", "-1", true, false, NaN, Infinity, +Infinity, null, undefined, {}, [], Array, Object, Boolean, A]; values.forEach(function (v) { trace(getQualifiedClassName(v)); }); trace("--- DONE ---"); }
Add test case.
Add test case.
ActionScript
apache-2.0
tschneidereit/shumway,mozilla/shumway,yurydelendik/shumway,mbebenita/shumway,yurydelendik/shumway,mozilla/shumway,mozilla/shumway,mozilla/shumway,mbebenita/shumway,mbebenita/shumway,mozilla/shumway,yurydelendik/shumway,tschneidereit/shumway,tschneidereit/shumway,mbebenita/shumway,mozilla/shumway,yurydelendik/shumway,yurydelendik/shumway,mozilla/shumway,mozilla/shumway,tschneidereit/shumway,mbebenita/shumway,yurydelendik/shumway,mbebenita/shumway,mbebenita/shumway,yurydelendik/shumway,tschneidereit/shumway,tschneidereit/shumway,mbebenita/shumway,tschneidereit/shumway,tschneidereit/shumway,yurydelendik/shumway
59fe280f1d1e7195e90d8aecc6855e453b21e0c3
src/com/google/analytics/log.as
src/com/google/analytics/log.as
package com.google.analytics { import core.Logger; import core.log; public const log:Logger = core.log; /* note: we use the logd library http://code.google.com/p/maashaack/wiki/logd Within your IDE when you build locally for Flash Builder in Project Properties then ActionScript Compiler under "Additional compiler arguments": -locale en_US -load-config build/config-local.xml the Ant build will use build/config.xml to produce gaforflash.swc and build/config-debug.xml to produce gaforflash_d.swc We use conditional compilation see: http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html that means everything written within LOG::P{ ... } is not included in the final binary when LOG::P is set to false */ LOG::P { var cfg:Object = { sep: " ", //char separator mode: "clean", // "raw", "clean", "data", "short" tag: true, //use tag time: true //use time }; log.config( cfg ); log.level = log.VERBOSE; } }
add log instance for GA
add log instance for GA
ActionScript
apache-2.0
nsdevaraj/gaforflash,minimedj/gaforflash,nsdevaraj/gaforflash,minimedj/gaforflash
d7c70c2524586fb1fa890edc7f78badb3aac03a0
happy-new-year.as
happy-new-year.as
// Happy New Year in ActionScript 3. Place code in the first frame Actions. var t:TextField=new TextField(); t.text="Happy New Year"; addChild(t);
Add Action script
Add Action script
ActionScript
mit
alihesari/Happy-New-Year,alihesari/Happy-New-Year,alihesari/Happy-New-Year,alihesari/Happy-New-Year,alihesari/Happy-New-Year,alihesari/Happy-New-Year,alihesari/Happy-New-Year,alihesari/Happy-New-Year,alihesari/Happy-New-Year,alihesari/Happy-New-Year,alihesari/Happy-New-Year,alihesari/Happy-New-Year,alihesari/Happy-New-Year,alihesari/Happy-New-Year,alihesari/Happy-New-Year
0a1999c55f9bd2420ff60c304f122b01a0c287ce
src/as/com/threerings/util/ParameterUtil.as
src/as/com/threerings/util/ParameterUtil.as
package com.threerings.util { import flash.display.DisplayObject; import flash.events.Event; import flash.events.IOErrorEvent; import flash.net.URLLoader; import flash.net.URLRequest; /** * A utility for loading parameters from an XML file when run from * the local filesystem. * * The file "parameters.xml" should reside in the current directory and contains: * <parameters> * <param name="name1" value="val1"/> * <param name="name2" value="val2"/> * </parameters> */ public class ParameterUtil { /** * Get the parameters. * Note: the callback function may be called prior to this method * returning. */ public static function getParameters (disp :DisplayObject, callback :Function) :void { var url :String = disp.root.loaderInfo.url; // normal parameters if (url == null || 0 != url.indexOf("file:")) { callback(disp.root.loaderInfo.parameters); return; } // instead read from XML var loader :URLLoader = new URLLoader(); loader.addEventListener(IOErrorEvent.IO_ERROR, function (event :Event) :void { trace("Error loading params: " + event); callback(disp.root.loaderInfo.parameters); } ); loader.addEventListener(Event.COMPLETE, function (event :Event) :void { var data :XML = XML(loader.data); var params :Object = {}; for each (var param :XML in data..param) { params[param.@name] = String(param.@value); } callback(params); } ); loader.load(new URLRequest("file:parameters.xml")); } } }
read params from an XML file we're loaded from the file system.
ParameterUtil: read params from an XML file we're loaded from the file system. git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@4615 542714f4-19e9-0310-aa3c-eee0fc999fb1
ActionScript
lgpl-2.1
threerings/narya,threerings/narya,threerings/narya,threerings/narya,threerings/narya
c08d88bf516b4abf510557701fccba8ed252c866
test/acceptance/as3/sampling/StringMaster.as
test/acceptance/as3/sampling/StringMaster.as
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is [Open Source Virtual Machine.]. * * The Initial Developer of the Original Code is * Adobe System Incorporated. * Portions created by the Initial Developer are Copyright (C) 2010 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adobe AS3 Team * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* testcases: * master string exposed to heap graph */ package { import flash.sampler.* import avmplus.* var SECTION = "Sampling"; var VERSION = "AS3"; var TITLE = "Master String"; startTest(); writeHeaderToLog("Sampling master string test"); var isdebugger=System.isDebugger(); var helloWorld = "hello, world"; var hello = helloWorld.substr(0, 5); AddTestCase("assert that static string constant does not have a master string", null, getMasterString(helloWorld)); AddTestCase("assert that substring has a master string", isdebugger ? helloWorld : null, getMasterString(hello)); test(); }
Add this back
Add this back
ActionScript
mpl-2.0
pfgenyun/tamarin-redux,pfgenyun/tamarin-redux,pfgenyun/tamarin-redux,pfgenyun/tamarin-redux,pnkfelix/tamarin-redux,pfgenyun/tamarin-redux,pnkfelix/tamarin-redux,pfgenyun/tamarin-redux,pnkfelix/tamarin-redux,pnkfelix/tamarin-redux,pnkfelix/tamarin-redux,pnkfelix/tamarin-redux,pfgenyun/tamarin-redux,pfgenyun/tamarin-redux,pnkfelix/tamarin-redux
72a8c8c6d0294ee16b97422d012c1029ea215ef1
src/CameraMan.as
src/CameraMan.as
package { import flash.display.Sprite; import flash.display.StageScaleMode; import flash.display.StageAlign; import flash.geom.Point; import flash.external.ExternalInterface; import flash.display.Bitmap; import flash.display.BitmapData; import flash.media.Camera; import flash.media.Video; import flash.utils.ByteArray; import mx.graphics.codec.JPEGEncoder; import flash.events.Event; import flash.events.HTTPStatusEvent; import flash.events.IOErrorEvent; import flash.events.SecurityErrorEvent; import flash.net.URLLoader; import flash.net.URLRequest; public class CameraMan extends Sprite { private var videoface:Video; private var cam:Camera; private var photo:BitmapData; private var sendto:String; private var movieSize:Point; public function CameraMan() { stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; sendto = stage.loaderInfo.parameters.sendto; movieSize = new Point(stage.loaderInfo.width, stage.loaderInfo.height); this.initCamera(); if (ExternalInterface.available) { ExternalInterface.addCallback("takePhoto", takePhoto); ExternalInterface.addCallback("sendPhoto", sendPhoto); } } public function initCamera() : void { videoface = new Video(movieSize.x, movieSize.y); this.addChild(this.videoface); cam = Camera.getCamera(); cam.setMode(width, height, 15); videoface.attachCamera(cam); } public function takePhoto() : void { // freeze image try { photo = new BitmapData(videoface.videoWidth, videoface.videoHeight, false); photo.draw(videoface); // Swap the video for the captured bitmap. var bitty:Bitmap = new Bitmap(photo); this.addChild(bitty); this.removeChild(videoface); } catch(err:Error) { trace(err.name + " " + err.message); } if (ExternalInterface.available) { ExternalInterface.call('cameraman._tookPhoto'); } } public function sendPhoto() : void { try { // produce image file var peggy:JPEGEncoder = new JPEGEncoder(75.0); var image:ByteArray = peggy.encode(photo); // send image file to server var req:URLRequest = new URLRequest(); req.url = this.sendto; req.method = "POST"; req.contentType = peggy.contentType; req.data = image; var http:URLLoader = new URLLoader(); http.addEventListener("complete", sentPhoto); http.addEventListener("ioError", sendingIOError); http.addEventListener("securityError", sendingSecurityError); http.addEventListener("httpStatus", sendingHttpStatus); http.load(req); } catch(err:Error) { trace(err.name + " " + err.message); } } public function sendingHttpStatus(event:HTTPStatusEvent) : void { trace("HTTPStatus: " + event.status + " " + event.target); } public function sendingIOError(event:IOErrorEvent) : void { trace("IOError: " + event.type + " " + event.text + " " + event.target + " " + event.target.bytesLoaded); } public function sendingSecurityError(event:SecurityErrorEvent) : void { trace("SecurityError: " + event.text + " " + event.target); } public function sentPhoto(event:Event) : void { var url:String = event.target.data; if (ExternalInterface.available) ExternalInterface.call('cameraman._sentPhoto', url); } } }
Add existing CameraMan source (such as it is)
Add existing CameraMan source (such as it is)
ActionScript
mit
markpasc/cameraman
969ae27b78e5252d95d53c2ac482eafeb899e437
bin/Data/Scripts/43_HttpRequestDemo.as
bin/Data/Scripts/43_HttpRequestDemo.as
// Http request example. // This example demonstrates: // - How to use Http request API #include "Scripts/Utilities/Sample.as" String message; Text@ text; HttpRequest@ httpRequest; void Start() { // Execute the common startup for samples SampleStart(); // Create the user interface CreateUI(); // Set the mouse mode to use in the sample SampleInitMouseMode(MM_FREE); // Subscribe to basic events such as update SubscribeToEvents(); } void CreateUI() { // Construct new Text object text = Text(); // Set font and text color text.SetFont(cache.GetResource("Font", "Fonts/Anonymous Pro.ttf"), 15); text.color = Color(1.0f, 1.0f, 0.0f); // Align Text center-screen text.horizontalAlignment = HA_CENTER; text.verticalAlignment = VA_CENTER; // Add Text instance to the UI root element ui.root.AddChild(text); } void SubscribeToEvents() { // Subscribe HandleUpdate() function for processing HTTP request SubscribeToEvent("Update", "HandleUpdate"); } void HandleUpdate(StringHash eventType, VariantMap& eventData) { // Create HTTP request if (httpRequest is null) httpRequest = network.MakeHttpRequest("http://httpbin.org/ip", "GET"); else { // Initializing HTTP request if (httpRequest.state == HTTP_INITIALIZING) return; // An error has occured else if (httpRequest.state == HTTP_ERROR) { text.text = "An error has occured."; UnsubscribeFromEvent("Update"); } // Get message data else { if (httpRequest.availableSize > 0) message += httpRequest.ReadLine(); else { text.text = "Processing..."; JSONFile@ json = JSONFile(); json.FromString(message); JSONValue val = json.GetRoot().Get("origin"); if (val.isNull) text.text = "Invalid string."; else text.text = "Your IP is: " + val.GetString(); UnsubscribeFromEvent("Update"); } } } } // Create XML patch instructions for screen joystick layout specific to this sample app String patchInstructions = "<patch>" + " <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">" + " <attribute name=\"Is Visible\" value=\"false\" />" + " </add>" + "</patch>";
Add AngelScript Http Request demo sample.
Add AngelScript Http Request demo sample.
ActionScript
mit
PredatorMF/Urho3D,SuperWangKai/Urho3D,MeshGeometry/Urho3D,henu/Urho3D,fire/Urho3D-1,iainmerrick/Urho3D,eugeneko/Urho3D,codemon66/Urho3D,MeshGeometry/Urho3D,xiliu98/Urho3D,urho3d/Urho3D,codemon66/Urho3D,tommy3/Urho3D,codemon66/Urho3D,urho3d/Urho3D,carnalis/Urho3D,luveti/Urho3D,SirNate0/Urho3D,299299/Urho3D,MonkeyFirst/Urho3D,xiliu98/Urho3D,kostik1337/Urho3D,SuperWangKai/Urho3D,henu/Urho3D,victorholt/Urho3D,helingping/Urho3D,helingping/Urho3D,fire/Urho3D-1,codedash64/Urho3D,codedash64/Urho3D,kostik1337/Urho3D,fire/Urho3D-1,SuperWangKai/Urho3D,xiliu98/Urho3D,henu/Urho3D,helingping/Urho3D,kostik1337/Urho3D,helingping/Urho3D,rokups/Urho3D,xiliu98/Urho3D,cosmy1/Urho3D,bacsmar/Urho3D,carnalis/Urho3D,tommy3/Urho3D,299299/Urho3D,cosmy1/Urho3D,victorholt/Urho3D,abdllhbyrktr/Urho3D,luveti/Urho3D,rokups/Urho3D,iainmerrick/Urho3D,luveti/Urho3D,kostik1337/Urho3D,299299/Urho3D,bacsmar/Urho3D,c4augustus/Urho3D,eugeneko/Urho3D,urho3d/Urho3D,299299/Urho3D,abdllhbyrktr/Urho3D,MeshGeometry/Urho3D,carnalis/Urho3D,urho3d/Urho3D,c4augustus/Urho3D,orefkov/Urho3D,iainmerrick/Urho3D,PredatorMF/Urho3D,tommy3/Urho3D,weitjong/Urho3D,weitjong/Urho3D,luveti/Urho3D,codemon66/Urho3D,rokups/Urho3D,fire/Urho3D-1,SuperWangKai/Urho3D,cosmy1/Urho3D,MonkeyFirst/Urho3D,rokups/Urho3D,SuperWangKai/Urho3D,eugeneko/Urho3D,iainmerrick/Urho3D,victorholt/Urho3D,SirNate0/Urho3D,299299/Urho3D,iainmerrick/Urho3D,c4augustus/Urho3D,helingping/Urho3D,PredatorMF/Urho3D,fire/Urho3D-1,henu/Urho3D,orefkov/Urho3D,weitjong/Urho3D,abdllhbyrktr/Urho3D,codedash64/Urho3D,tommy3/Urho3D,c4augustus/Urho3D,orefkov/Urho3D,codedash64/Urho3D,c4augustus/Urho3D,kostik1337/Urho3D,carnalis/Urho3D,MonkeyFirst/Urho3D,rokups/Urho3D,299299/Urho3D,SirNate0/Urho3D,SirNate0/Urho3D,SirNate0/Urho3D,codemon66/Urho3D,cosmy1/Urho3D,carnalis/Urho3D,henu/Urho3D,weitjong/Urho3D,PredatorMF/Urho3D,MeshGeometry/Urho3D,MeshGeometry/Urho3D,luveti/Urho3D,rokups/Urho3D,weitjong/Urho3D,xiliu98/Urho3D,abdllhbyrktr/Urho3D,eugeneko/Urho3D,MonkeyFirst/Urho3D,MonkeyFirst/Urho3D,cosmy1/Urho3D,tommy3/Urho3D,orefkov/Urho3D,bacsmar/Urho3D,victorholt/Urho3D,bacsmar/Urho3D,abdllhbyrktr/Urho3D,victorholt/Urho3D,codedash64/Urho3D
07ea6a7a4cd86a024d98f52cce7415b87df89316
dolly-framework/src/test/actionscript/dolly/CopyingOfCompositeCopyableClassTest.as
dolly-framework/src/test/actionscript/dolly/CopyingOfCompositeCopyableClassTest.as
package dolly { import dolly.core.dolly_internal; import dolly.data.CompositeCopyableClass; import mx.collections.ArrayCollection; import mx.collections.ArrayList; import org.as3commons.reflect.Field; import org.as3commons.reflect.Type; import org.flexunit.asserts.assertEquals; import org.flexunit.asserts.assertNotNull; use namespace dolly_internal; public class CopyingOfCompositeCopyableClassTest { private var compositeCopyableClass:CompositeCopyableClass; private var compositeCopyableClassType:Type; [Before] public function before():void { compositeCopyableClass = new CompositeCopyableClass(); compositeCopyableClass.array = [1, 2, 3, 4, 5]; compositeCopyableClass.arrayList = new ArrayList([1, 2, 3, 4, 5]); compositeCopyableClass.arrayCollection = new ArrayCollection([1, 2, 3, 4, 5]); compositeCopyableClassType = Type.forInstance(compositeCopyableClass); } [After] public function after():void { compositeCopyableClass = null; compositeCopyableClassType = null; } [Test] public function findingAllWritableFieldsForType():void { const writableFields:Vector.<Field> = Copier.findCopyableFieldsForType(compositeCopyableClassType); assertNotNull(writableFields); assertEquals(4, writableFields.length); } } }
Add new test class: CopyingOfCompositeCopyableClassTest.
Add new test class: CopyingOfCompositeCopyableClassTest.
ActionScript
mit
Yarovoy/dolly
8587dc4a95607e21c0ca737f6e4eafc1e8b903a6
crt/amd64-linux/crt.as
crt/amd64-linux/crt.as
.file "crt.as" .text .global _start _start: call $main movl %eax, %edi call $exit
add amd64-linux crt
[crt] add amd64-linux crt
ActionScript
isc
k0gaMSX/scc,k0gaMSX/scc,k0gaMSX/scc
ccbd8229cdec18d0ae770bbd27a9f399465b25f9
tests/examplefiles/as3_test.as
tests/examplefiles/as3_test.as
import flash.events.MouseEvent; import com.example.programmingas3.playlist.PlayList; import com.example.programmingas3.playlist.Song; import com.example.programmingas3.playlist.SortProperty; // constants for the different "states" of the song form private static const ADD_SONG:uint = 1; private static const SONG_DETAIL:uint = 2; private var playList:PlayList = new PlayList(); private function initApp():void { // set the initial state of the song form, for adding a new song setFormState(ADD_SONG); // prepopulate the list with a few songs playList.addSong(new Song("Nessun Dorma", "Luciano Pavarotti", 1990, "nessundorma.mp3", ["90's", "Opera"])); playList.addSong(new Song("Come Undone", "Duran Duran", 1993, "comeundone.mp3", ["90's", "Pop"])); playList.addSong(new Song("Think of Me", "Sarah Brightman", 1987, "thinkofme.mp3", ["Showtunes"])); playList.addSong(new Song("Unbelievable", "EMF", 1991, "unbelievable.mp3", ["90's", "Pop"])); songList.dataProvider = playList.songList; } private function sortList(sortField:SortProperty):void { // Make all the sort type buttons enabled. // The active one will be grayed-out below sortByTitle.selected = false; sortByArtist.selected = false; sortByYear.selected = false; switch (sortField) { case SortProperty.TITLE: sortByTitle.selected = true; break; case SortProperty.ARTIST: sortByArtist.selected = true; break; case SortProperty.YEAR: sortByYear.selected = true; break; } playList.sortList(sortField); refreshList(); } private function refreshList():void { // remember which song was selected var selectedSong:Song = Song(songList.selectedItem); // re-assign the song list as the dataprovider to get the newly sorted list // and force the List control to refresh itself songList.dataProvider = playList.songList; // reset the song selection if (selectedSong != null) { songList.selectedItem = selectedSong; } } private function songSelectionChange():void { if (songList.selectedIndex != -1) { setFormState(SONG_DETAIL); } else { setFormState(ADD_SONG); } } private function addNewSong():void { // gather the values from the form and add the new song var title:String = newSongTitle.text; var artist:String = newSongArtist.text; var year:uint = newSongYear.value; var filename:String = newSongFilename.text; var genres:Array = newSongGenres.selectedItems; playList.addSong(new Song(title, artist, year, filename, genres)); refreshList(); // clear out the "add song" form fields setFormState(ADD_SONG); } private function songListLabel(item:Object):String { return item.toString(); } private function setFormState(state:uint):void { // set the form title and control state switch (state) { case ADD_SONG: formTitle.text = "Add New Song"; // show the submit button submitSongData.visible = true; showAddControlsBtn.visible = false; // clear the form fields newSongTitle.text = ""; newSongArtist.text = ""; newSongYear.value = (new Date()).fullYear; newSongFilename.text = ""; newSongGenres.selectedIndex = -1; // deselect the currently selected song (if any) songList.selectedIndex = -1; break; case SONG_DETAIL: formTitle.text = "Song Details"; // populate the form with the selected item's data var selectedSong:Song = Song(songList.selectedItem); newSongTitle.text = selectedSong.title; newSongArtist.text = selectedSong.artist; newSongYear.value = selectedSong.year; newSongFilename.text = selectedSong.filename; newSongGenres.selectedItems = selectedSong.genres; // hide the submit button submitSongData.visible = false; showAddControlsBtn.visible = true; break; } }
Add AS3 example.
Add AS3 example.
ActionScript
bsd-2-clause
sol/pygments,zmughal/pygments-mirror,zmughal/pygments-mirror,zmughal/pygments-mirror,zmughal/pygments-mirror,sol/pygments,sol/pygments,zmughal/pygments-mirror,zmughal/pygments-mirror,sol/pygments,sol/pygments,zmughal/pygments-mirror,zmughal/pygments-mirror,sol/pygments,sol/pygments,sol/pygments,zmughal/pygments-mirror,sol/pygments,sol/pygments,sol/pygments,sol/pygments,zmughal/pygments-mirror,zmughal/pygments-mirror,zmughal/pygments-mirror,zmughal/pygments-mirror,sol/pygments,zmughal/pygments-mirror,zmughal/pygments-mirror,zmughal/pygments-mirror,zmughal/pygments-mirror,zmughal/pygments-mirror,zmughal/pygments-mirror,sol/pygments
4190ca7416c651caf83f722595b7e117d9017f07
tests/examplefiles/as3_test.as
tests/examplefiles/as3_test.as
import flash.events.MouseEvent; import com.example.programmingas3.playlist.PlayList; import com.example.programmingas3.playlist.Song; import com.example.programmingas3.playlist.SortProperty; // constants for the different "states" of the song form private static const ADD_SONG:uint = 1; private static const SONG_DETAIL:uint = 2; private var playList:PlayList = new PlayList(); private function initApp():void { // set the initial state of the song form, for adding a new song setFormState(ADD_SONG); // prepopulate the list with a few songs playList.addSong(new Song("Nessun Dorma", "Luciano Pavarotti", 1990, "nessundorma.mp3", ["90's", "Opera"])); playList.addSong(new Song("Come Undone", "Duran Duran", 1993, "comeundone.mp3", ["90's", "Pop"])); playList.addSong(new Song("Think of Me", "Sarah Brightman", 1987, "thinkofme.mp3", ["Showtunes"])); playList.addSong(new Song("Unbelievable", "EMF", 1991, "unbelievable.mp3", ["90's", "Pop"])); songList.dataProvider = playList.songList; } private function sortList(sortField:SortProperty):void { // Make all the sort type buttons enabled. // The active one will be grayed-out below sortByTitle.selected = false; sortByArtist.selected = false; sortByYear.selected = false; switch (sortField) { case SortProperty.TITLE: sortByTitle.selected = true; break; case SortProperty.ARTIST: sortByArtist.selected = true; break; case SortProperty.YEAR: sortByYear.selected = true; break; } playList.sortList(sortField); refreshList(); } private function refreshList():void { // remember which song was selected var selectedSong:Song = Song(songList.selectedItem); // re-assign the song list as the dataprovider to get the newly sorted list // and force the List control to refresh itself songList.dataProvider = playList.songList; // reset the song selection if (selectedSong != null) { songList.selectedItem = selectedSong; } } private function songSelectionChange():void { if (songList.selectedIndex != -1) { setFormState(SONG_DETAIL); } else { setFormState(ADD_SONG); } } private function addNewSong():void { // gather the values from the form and add the new song var title:String = newSongTitle.text; var artist:String = newSongArtist.text; var year:uint = newSongYear.value; var filename:String = newSongFilename.text; var genres:Array = newSongGenres.selectedItems; playList.addSong(new Song(title, artist, year, filename, genres)); refreshList(); // clear out the "add song" form fields setFormState(ADD_SONG); } private function songListLabel(item:Object):String { return item.toString(); } private function setFormState(state:uint):void { // set the form title and control state switch (state) { case ADD_SONG: formTitle.text = "Add New Song"; // show the submit button submitSongData.visible = true; showAddControlsBtn.visible = false; // clear the form fields newSongTitle.text = ""; newSongArtist.text = ""; newSongYear.value = (new Date()).fullYear; newSongFilename.text = ""; newSongGenres.selectedIndex = -1; // deselect the currently selected song (if any) songList.selectedIndex = -1; break; case SONG_DETAIL: formTitle.text = "Song Details"; // populate the form with the selected item's data var selectedSong:Song = Song(songList.selectedItem); newSongTitle.text = selectedSong.title; newSongArtist.text = selectedSong.artist; newSongYear.value = selectedSong.year; newSongFilename.text = selectedSong.filename; newSongGenres.selectedItems = selectedSong.genres; // hide the submit button submitSongData.visible = false; showAddControlsBtn.visible = true; break; } }
Add AS3 example.
Add AS3 example. --HG-- branch : trunk
ActionScript
bsd-2-clause
Khan/pygments,nsfmc/pygments,kirbyfan64/pygments-unofficial,Khan/pygments,Khan/pygments,kirbyfan64/pygments-unofficial,nsfmc/pygments,kirbyfan64/pygments-unofficial,dbrgn/pygments-mirror,kirbyfan64/pygments-unofficial,nsfmc/pygments,nsfmc/pygments,Khan/pygments,Khan/pygments,dbrgn/pygments-mirror,Khan/pygments,nsfmc/pygments,dbrgn/pygments-mirror,kirbyfan64/pygments-unofficial,dbrgn/pygments-mirror,Khan/pygments,dbrgn/pygments-mirror,Khan/pygments,dbrgn/pygments-mirror,nsfmc/pygments,nsfmc/pygments,kirbyfan64/pygments-unofficial,nsfmc/pygments,kirbyfan64/pygments-unofficial,kirbyfan64/pygments-unofficial,dbrgn/pygments-mirror,kirbyfan64/pygments-unofficial,Khan/pygments,nsfmc/pygments,kirbyfan64/pygments-unofficial,dbrgn/pygments-mirror,dbrgn/pygments-mirror,kirbyfan64/pygments-unofficial,Khan/pygments,kirbyfan64/pygments-unofficial,kirbyfan64/pygments-unofficial,kirbyfan64/pygments-unofficial,nsfmc/pygments,dbrgn/pygments-mirror,nsfmc/pygments,dbrgn/pygments-mirror,nsfmc/pygments,dbrgn/pygments-mirror,dbrgn/pygments-mirror,Khan/pygments,Khan/pygments,Khan/pygments,nsfmc/pygments,Khan/pygments,kirbyfan64/pygments-unofficial,nsfmc/pygments,dbrgn/pygments-mirror,dbrgn/pygments-mirror,dbrgn/pygments-mirror,Khan/pygments,nsfmc/pygments,nsfmc/pygments,kirbyfan64/pygments-unofficial,Khan/pygments
d27831e53ccae4f831767a03d3ab441398529cc0
src/com/esri/viewer/utils/LabelUtil.as
src/com/esri/viewer/utils/LabelUtil.as
/////////////////////////////////////////////////////////////////////////// // Copyright (c) 2011 Esri. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /////////////////////////////////////////////////////////////////////////// package com.esri.viewer.utils { import mx.core.FlexGlobals; import spark.utils.LabelUtil; public final class LabelUtil { public static function findLongestItemLabel(items:Array, labelField:String = null, labelFunction:Function = null):String { var currentItemWidth:Number; var longestItemLabel:String = ""; var longestItemLabelWidth:Number = 0; var currentItemLabel:String; for each (var item:Object in items) { currentItemLabel = spark.utils.LabelUtil.itemToLabel(item, labelField, labelFunction); currentItemWidth = FlexGlobals.topLevelApplication.measureText(currentItemLabel).width; if (currentItemWidth > longestItemLabelWidth) { longestItemLabelWidth = currentItemWidth; longestItemLabel = currentItemLabel; } } return longestItemLabel; } } }
Add LabelUtil.
Add LabelUtil.
ActionScript
apache-2.0
CanterburyRegionalCouncil/arcgis-viewer-flex,Esri/arcgis-viewer-flex,CanterburyRegionalCouncil/arcgis-viewer-flex,CanterburyRegionalCouncil/arcgis-viewer-flex,Esri/arcgis-viewer-flex
3974657a7746e6442883a5b8d4d4b2ed4c6dfe5f
dolly-framework/src/test/actionscript/dolly/CopyingOfPropertyLevelCopyableSubclassTest.as
dolly-framework/src/test/actionscript/dolly/CopyingOfPropertyLevelCopyableSubclassTest.as
package dolly { import dolly.core.dolly_internal; import dolly.data.PropertyLevelCopyableSubclass; import org.as3commons.reflect.Field; import org.as3commons.reflect.Type; import org.flexunit.asserts.assertEquals; import org.flexunit.asserts.assertFalse; import org.flexunit.asserts.assertNotNull; use namespace dolly_internal; public class CopyingOfPropertyLevelCopyableSubclassTest { private var propertyLevelCopyableSubclass:PropertyLevelCopyableSubclass; private var propertyLevelCopyableSubclassType:Type; [Before] public function before():void { propertyLevelCopyableSubclass = new PropertyLevelCopyableSubclass(); propertyLevelCopyableSubclass.property1 = "property1 value"; propertyLevelCopyableSubclass.property2 = "property2 value"; propertyLevelCopyableSubclass.property3 = "property3 value"; propertyLevelCopyableSubclass.property4 = "property4 value"; propertyLevelCopyableSubclass.writableField1 = "writableField1 value"; propertyLevelCopyableSubclass.writableField2 = "writableField2 value"; propertyLevelCopyableSubclassType = Type.forInstance(propertyLevelCopyableSubclass); } [After] public function after():void { propertyLevelCopyableSubclass = null; propertyLevelCopyableSubclassType = null; } [Test] public function findingAllCopyableFieldsForType():void { const copyableFields:Vector.<Field> = Copier.findCopyableFieldsForType(propertyLevelCopyableSubclassType); assertNotNull(copyableFields); assertEquals(4, copyableFields.length); assertNotNull(copyableFields[0]); assertNotNull(copyableFields[1]); assertNotNull(copyableFields[2]); assertNotNull(copyableFields[3]); } [Test] public function copyingByCopier():void { const copyInstance:PropertyLevelCopyableSubclass = Copier.copy(propertyLevelCopyableSubclass); assertNotNull(copyInstance); assertNotNull(copyInstance.property1); assertEquals(copyInstance.property1, propertyLevelCopyableSubclass.property1); assertNotNull(copyInstance.property2); assertFalse(copyInstance.property2 == propertyLevelCopyableSubclass.property2); assertNotNull(copyInstance.property3); assertEquals(copyInstance.property3, propertyLevelCopyableSubclass.property3); assertNotNull(copyInstance.property4); assertFalse(copyInstance.property4 == propertyLevelCopyableSubclass.property4); assertNotNull(copyInstance.writableField1); assertEquals(copyInstance.writableField1, propertyLevelCopyableSubclass.writableField1); assertNotNull(copyInstance.writableField2); assertEquals(copyInstance.writableField2, propertyLevelCopyableSubclass.writableField2); } [Test] public function copyingByCopyFunction():void { const copyInstance:PropertyLevelCopyableSubclass = copy(propertyLevelCopyableSubclass); assertNotNull(copyInstance); assertNotNull(copyInstance.property1); assertEquals(copyInstance.property1, propertyLevelCopyableSubclass.property1); assertNotNull(copyInstance.property2); assertFalse(copyInstance.property2 == propertyLevelCopyableSubclass.property2); assertNotNull(copyInstance.property3); assertEquals(copyInstance.property3, propertyLevelCopyableSubclass.property3); assertNotNull(copyInstance.property4); assertFalse(copyInstance.property4 == propertyLevelCopyableSubclass.property4); assertNotNull(copyInstance.writableField1); assertEquals(copyInstance.writableField1, propertyLevelCopyableSubclass.writableField1); assertNotNull(copyInstance.writableField2); assertEquals(copyInstance.writableField2, propertyLevelCopyableSubclass.writableField2); } } }
Create new test class: CopyingOfPropertyLevelCopyableSubclassTest.
Create new test class: CopyingOfPropertyLevelCopyableSubclassTest.
ActionScript
mit
Yarovoy/dolly
7611e404a881f2c0392af66393f09e4cc40162da
dolly-framework/src/main/actionscript/dolly/utils/ClassUtil.as
dolly-framework/src/main/actionscript/dolly/utils/ClassUtil.as
package dolly.utils { import flash.net.registerClassAlias; import flash.utils.getQualifiedClassName; public class ClassUtil { public static function getFullClassName(clazz:Class):String { return getQualifiedClassName(clazz).replace("::", "."); } public static function registerAliasFor(clazz:Class):void { registerClassAlias( getFullClassName(clazz), clazz ); } } }
Create new utility class: ClassUtil.
Create new utility class: ClassUtil.
ActionScript
mit
Yarovoy/dolly
b9040480ae20c0648598c148973832499450b30e
tests/examplefiles/as3_test.as
tests/examplefiles/as3_test.as
import flash.events.MouseEvent; import com.example.programmingas3.playlist.PlayList; import com.example.programmingas3.playlist.Song; import com.example.programmingas3.playlist.SortProperty; // constants for the different "states" of the song form private static const ADD_SONG:uint = 1; private static const SONG_DETAIL:uint = 2; private var playList:PlayList = new PlayList(); private function initApp():void { // set the initial state of the song form, for adding a new song setFormState(ADD_SONG); // prepopulate the list with a few songs playList.addSong(new Song("Nessun Dorma", "Luciano Pavarotti", 1990, "nessundorma.mp3", ["90's", "Opera"])); playList.addSong(new Song("Come Undone", "Duran Duran", 1993, "comeundone.mp3", ["90's", "Pop"])); playList.addSong(new Song("Think of Me", "Sarah Brightman", 1987, "thinkofme.mp3", ["Showtunes"])); playList.addSong(new Song("Unbelievable", "EMF", 1991, "unbelievable.mp3", ["90's", "Pop"])); songList.dataProvider = playList.songList; } private function sortList(sortField:SortProperty):void { // Make all the sort type buttons enabled. // The active one will be grayed-out below sortByTitle.selected = false; sortByArtist.selected = false; sortByYear.selected = false; switch (sortField) { case SortProperty.TITLE: sortByTitle.selected = true; break; case SortProperty.ARTIST: sortByArtist.selected = true; break; case SortProperty.YEAR: sortByYear.selected = true; break; } playList.sortList(sortField); refreshList(); } private function refreshList():void { // remember which song was selected var selectedSong:Song = Song(songList.selectedItem); // re-assign the song list as the dataprovider to get the newly sorted list // and force the List control to refresh itself songList.dataProvider = playList.songList; // reset the song selection if (selectedSong != null) { songList.selectedItem = selectedSong; } } private function songSelectionChange():void { if (songList.selectedIndex != -1) { setFormState(SONG_DETAIL); } else { setFormState(ADD_SONG); } } private function addNewSong():void { // gather the values from the form and add the new song var title:String = newSongTitle.text; var artist:String = newSongArtist.text; var year:uint = newSongYear.value; var filename:String = newSongFilename.text; var genres:Array = newSongGenres.selectedItems; playList.addSong(new Song(title, artist, year, filename, genres)); refreshList(); // clear out the "add song" form fields setFormState(ADD_SONG); } private function songListLabel(item:Object):String { return item.toString(); } private function setFormState(state:uint):void { // set the form title and control state switch (state) { case ADD_SONG: formTitle.text = "Add New Song"; // show the submit button submitSongData.visible = true; showAddControlsBtn.visible = false; // clear the form fields newSongTitle.text = ""; newSongArtist.text = ""; newSongYear.value = (new Date()).fullYear; newSongFilename.text = ""; newSongGenres.selectedIndex = -1; // deselect the currently selected song (if any) songList.selectedIndex = -1; break; case SONG_DETAIL: formTitle.text = "Song Details"; // populate the form with the selected item's data var selectedSong:Song = Song(songList.selectedItem); newSongTitle.text = selectedSong.title; newSongArtist.text = selectedSong.artist; newSongYear.value = selectedSong.year; newSongFilename.text = selectedSong.filename; newSongGenres.selectedItems = selectedSong.genres; // hide the submit button submitSongData.visible = false; showAddControlsBtn.visible = true; break; } }
Add AS3 example.
Add AS3 example.
ActionScript
bsd-2-clause
erickt/pygments,erickt/pygments,erickt/pygments,erickt/pygments,erickt/pygments,erickt/pygments,erickt/pygments,erickt/pygments,erickt/pygments,erickt/pygments,erickt/pygments,erickt/pygments
4b854a51cb4dfafec8adaefcffce001778df7c58
src/TestRunner.as
src/TestRunner.as
/* * Copyright 2008 Adobe Systems Inc., 2008 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Contributor(s): * Zwetan Kjukov <[email protected]>. */ package { import library.ASTUce.Runner; import com.google.analytics.AllTests; import flash.display.Sprite; public class TestRunner extends Sprite { public function TestRunner() { Runner.main( com.google.analytics.AllTests.suite( ) ); } } }
rename to TestRunner
rename to TestRunner
ActionScript
apache-2.0
minimedj/gaforflash,nsdevaraj/gaforflash,nsdevaraj/gaforflash,minimedj/gaforflash
a98a215c12a843de44da8886159f2e1e75f87e65
dolly-framework/src/test/actionscript/dolly/CopyingOfCopyableCloneableClassTest.as
dolly-framework/src/test/actionscript/dolly/CopyingOfCopyableCloneableClassTest.as
package dolly { import dolly.core.dolly_internal; import dolly.data.CopyableCloneableClass; import org.as3commons.reflect.Field; import org.as3commons.reflect.Type; import org.flexunit.asserts.assertEquals; import org.flexunit.asserts.assertNotNull; use namespace dolly_internal; public class CopyingOfCopyableCloneableClassTest { private var copyableCloneableClass:CopyableCloneableClass; private var copyableCloneableClassType:Type; [Before] public function before():void { copyableCloneableClass = new CopyableCloneableClass(); copyableCloneableClass.property1 = "property1 value"; copyableCloneableClass.writableField1 = "writableField1 value"; copyableCloneableClassType = Type.forInstance(copyableCloneableClass); } [After] public function after():void { copyableCloneableClass = null; copyableCloneableClassType = null; } [Test] public function findingAllWritableFieldsForType():void { const writableFields:Vector.<Field> = Copier.findCopyableFieldsForType(copyableCloneableClassType); assertNotNull(writableFields); assertEquals(2, writableFields.length); } [Test] public function cloningByCloner():void { const clone:CopyableCloneableClass = Copier.copy(copyableCloneableClass); assertNotNull(clone); assertNotNull(clone.property1); assertEquals(clone.property1, copyableCloneableClass.property1); assertNotNull(clone.writableField1); assertEquals(clone.writableField1, copyableCloneableClass.writableField1); } [Test] public function cloningByCloneFunction():void { const cloneInstance:CopyableCloneableClass = copy(copyableCloneableClass); assertNotNull(cloneInstance); assertNotNull(cloneInstance.property1); assertEquals(cloneInstance.property1, copyableCloneableClass.property1); assertNotNull(cloneInstance.writableField1); assertEquals(cloneInstance.writableField1, copyableCloneableClass.writableField1); } } }
Create new test class CopyingOfCopyableCloneableClassTest for testing of creation copies for CopyableCloneableClass.
Create new test class CopyingOfCopyableCloneableClassTest for testing of creation copies for CopyableCloneableClass.
ActionScript
mit
Yarovoy/dolly
2766247cf4991318d7ef05f8b88781efd5a9eb0b
dolly-framework/src/test/resources/dolly/data/PropertyLevelCopyableSubclass.as
dolly-framework/src/test/resources/dolly/data/PropertyLevelCopyableSubclass.as
package dolly.data { public class PropertyLevelCopyableSubclass extends PropertyLevelCopyableClass { [Copyable] public static var staticProperty3:String = "Value of second-level static property 3."; public static var staticProperty4:String = "Value of second-level static property 4."; [Copyable] private var _writableField2:String = "Value of second-level writable field."; [Copyable] public var property3:String = "Value of second-level public property 3."; public var property4:String = "Value of second-level public property 4."; public function PropertyLevelCopyableSubclass() { } [Copyable] public function get writableField2():String { return _writableField2; } public function set writableField2(value:String):void { _writableField2 = value; } [Copyable] public function get readOnlyField2():String { return "Value of second-level read-only field."; } } }
Add new test data subclass: PropertyLevelCopyableSubclass.
Add new test data subclass: PropertyLevelCopyableSubclass.
ActionScript
mit
Yarovoy/dolly
a6d3b568ff6335dc59def9987ed27b1c90856be0
frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ButtonAutoRepeatController.as
frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ButtonAutoRepeatController.as
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.html.staticControls.beads.controllers { import flash.events.IEventDispatcher; import flash.events.Event; import flash.events.MouseEvent; import flash.utils.clearInterval; import flash.utils.clearTimeout; import flash.utils.setInterval; import flash.utils.setTimeout; import org.apache.flex.core.IBead; import org.apache.flex.core.IStrand; public class ButtonAutoRepeatController implements IBead { public function ButtonAutoRepeatController() { } private var _strand:IStrand; public function get strand():IStrand { return _strand; } public function set strand(value:IStrand):void { _strand = value; IEventDispatcher(value).addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } public var delay:int = 250; public var interval:int = 100; private var timeout:uint; private var repeater:uint; private function mouseDownHandler(event:MouseEvent):void { event.target.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); event.target.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); setTimeout(sendFirstRepeat, delay); } private function mouseOutHandler(event:MouseEvent):void { event.target.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); event.target.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); if (repeater > 0) clearInterval(repeater); repeater = 0; if (timeout > 0) clearTimeout(timeout); timeout = 0; } private function mouseUpHandler(event:MouseEvent):void { event.target.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); event.target.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); if (repeater > 0) clearInterval(repeater); repeater = 0; if (timeout > 0) clearTimeout(timeout); timeout = 0; } private function sendFirstRepeat():void { clearTimeout(timeout); timeout = 0; repeater = setInterval(sendRepeats, interval); IEventDispatcher(_strand).dispatchEvent(new Event("buttonRepeat")); } private function sendRepeats():void { IEventDispatcher(_strand).dispatchEvent(new Event("buttonRepeat")); } } }
Add autorepeat for buttons
Add autorepeat for buttons git-svn-id: 00225d326fbeb9978ee2ea3564602c0fe18eb5d2@1441561 13f79535-47bb-0310-9956-ffa450edef68
ActionScript
apache-2.0
greg-dove/flex-asjs,greg-dove/flex-asjs,greg-dove/flex-asjs,greg-dove/flex-asjs
9db5a9ffa007b3a14cac65e518ab0334cc599e60
dolly-framework/src/test/actionscript/dolly/CopierTest.as
dolly-framework/src/test/actionscript/dolly/CopierTest.as
package dolly { public class CopierTest { [Before] public function before():void { } [After] public function after():void { } [Test] public function testSmth():void { } } }
Add empty CopierTest class.
Add empty CopierTest class.
ActionScript
mit
Yarovoy/dolly
a1fff585972cdb6508a07cea8f7a75e2a30961bc
utils/fsdgen.as
utils/fsdgen.as
import avmplus.System; import avmplus.FileSystem; import C.stdlib.*; const USAGE:String = <![CDATA[usage: %cmd options file This script generate SWF chunks of a font, by calling flex-fontkit.jar of Flex SDK. Supported font file types are TrueType, OpenType, TrueType Collection and Datafork TrueType. OPTIONS: -h Show this message -b Embeds the fonts bold face. -i Embeds the fonts italic face. -u Ouput uncompressed SWF -a alias Sets the fonts alias. The default is the fonts family name. -c length Sets the number of chars in each SWF chunks. The default is 100. Require RedTamarin %minversion, available here: http://code.google.com/p/redtamarin/ Require FLEX_HOME environment variable, defining location of Flex SDK folder.]]>; const INVALID_FILE:uint = 2; const ARG_ERROR:uint = 10; const INVALID_API:uint = 20; const MIN_VERSION:Array = [0, 3, 0];//0.3.0 function usage() { trace(USAGE.replace("%cmd", System.programFilename).replace("%minversion", MIN_VERSION.join("."))); } /* Check RedTamarin version */ var redTamarinVersion:Array = System.getRedtamarinVersion().split("."); if(parseInt(redTamarinVersion[2]) < MIN_VERSION[2] && parseInt(redTamarinVersion[1]) < MIN_VERSION[1] && parseInt(redTamarinVersion[0]) < MIN_VERSION[0]) { trace("Require RedTamarin shell equal or greated than %minversion. Current version is %currentversion\n".replace("%minversion", MIN_VERSION.join(".")).replace("%currentversion", redTamarinVersion.join("."))); usage(); System.exit(INVALID_API); } /* Check FLEX_HOME env var */ if(getenv("FLEX_HOME") == "" || getenv("FLEX_HOME") == null) { trace("Require environment variable FLEX_HOME. To define it, use this command:\n\tset FLEX_HOME=\"" + FileSystem.normalizePath("path/to/flex") + "\"\n"); usage(); System.exit(INVALID_API); } /* TODO check if java and jar of fontSWF are available */ var javaCmd:String = "java -Dsun.io.useCanonCaches=false -Xms32m -Xmx512m" var fontSWFJarCmd:String = " -jar \"%flexhome/lib/flex-fontkit.jar\" -3".replace("%flexhome", getenv("FLEX_HOME")); var chunkLength:uint = 100; var alias:String = null; var bold:Boolean = false, italic:Boolean = false; var file:String = null; /* Parse args */ var argv:Array = System.argv;//C argv[0] is not included (start at 0 without path of current exec) var argc:uint = argv.length; for(var i:uint = 0; i < argc; i++) { var arg:String = argv[i]; //Help if(arg == "-h" || arg == "-help" || arg == "--help" || arg == "-?") { usage(); System.exit(); } //Bold flag else if(arg == "-b" || arg == "-bold" || arg == "--bold") { bold = true; } //Italic flag else if(arg == "-i" || arg == "-italic" || arg == "--italic") { bold = true; } //Alias else if(arg == "-a" || arg == "-alias" || arg == "--alias") { if(i < argc - 1) { alias = argv[++i]; } else { trace("%arg requires an argument\n".replace("%arg", arg)); usage(); System.exit(ARG_ERROR); } } // else if(arg == "-c" || arg == "-chunk" || arg == "--chunk") { if(i < argc - 1) { chunkLength = argv[++i]; } else { trace("%arg requires an argument\n".replace("%arg", arg)); usage(); System.exit(ARG_ERROR); } } //Uncompressed flag /* http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/modules/swfutils/src/java/flash/swf/MovieEncoder.java -> http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/modules/swfutils/src/java/flash/swf/Header.java http://www.rgagnon.com/javadetails/java-0150.html */ else if(arg == "-u" || arg == "-uncompressed" || arg == "--uncompressed") { javaCmd += " -Dflex.swf.uncompressed=\"true\""; } //No more optional arguments, next is file else if(arg == "--") { if(i == argc - 2) { file = argv[++i]; } else if(i >= argc - 1) { trace("file is required.\n"); usage(); System.exit(ARG_ERROR); } else { trace("Can't handle more than one file at the same time.\n"); usage(); System.exit(ARG_ERROR); } } //Other arguments else if(arg.charAt() == "-") { trace("Invalid option: $arg\n".replace("%arg", arg)); usage(); System.exit(ARG_ERROR); } //Assumed as file (only one) else { //Is last argument if(i == argc - 1) { file = argv[i]; } else { trace("Can't handle more than one file at the same time.\n"); usage(); System.exit(ARG_ERROR); } } } /* File argument not found or file not exist */ if(file == null || file == "" || !FileSystem.isRegularFile(file)) { trace("Invalid file.\n"); usage(); System.exit(INVALID_FILE); } /* Alias is set */ if(alias != null && alias != "") fontSWFJarCmd += " -a " + alias; /* Bold */ if(bold) fontSWFJarCmd += " -b"; /* Italic */ if(italic) fontSWFJarCmd += " -i"; var max:uint = 0xFFFF; var i:uint = 0; while(last < max) { var first:uint = i++ * chunkLength; last = first + chunkLength - 1; var range:String = "U+" + ("000" + first.toString(16).toUpperCase()).substr(-4, 4) + "-U+" + ("000" + last.toString(16).toUpperCase()).substr(-4, 4); var cmd:String = javaCmd + fontSWFJarCmd + "-u \"%range\" -o \"%range\" \"%file\"".replace("%range", range).replace("%file", file); trace(System.popen(cmd)); }
Add fsdgen Redtamarin script
Add fsdgen Redtamarin script
ActionScript
mit
mems/fstream,mems/fstream
4544b145f0b324e84be81145051f31fd53644448
src/main/actionscript/com/castlabs/dash/utils/NetStreamCodes.as
src/main/actionscript/com/castlabs/dash/utils/NetStreamCodes.as
/***************************************************** * * Copyright 2009 Adobe Systems Incorporated. All Rights Reserved. * ***************************************************** * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * * The Initial Developer of the Original Code is Adobe Systems Incorporated. * Portions created by Adobe Systems Incorporated are Copyright (C) 2009 Adobe Systems * Incorporated. All Rights Reserved. * *****************************************************/ package com.castlabs.dash.utils { //[ExcludeClass] /** * @private * * The NetStreamCodes class provides static constants for event types * that a NetStream dispatches as NetStatusEvents. * <p>A NetClient uses some of these codes to register handlers for * callbacks.</p> * @see flash.events.NetStatusEvent * @see flash.net.NetStream * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public final class NetStreamCodes { /** * "status" * Data is not being received quickly enough to fill the buffer. * Data flow will be interrupted until the buffer refills, * at which time a NetStream.Buffer.Full message will be sent and the stream will begin playing again. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_BUFFER_EMPTY:String = "NetStream.Buffer.Empty"; /** * "status" * The buffer is full and the stream will begin playing. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_BUFFER_FULL:String = "NetStream.Buffer.Full"; /** * "status" * Data has finished streaming, and the remaining buffer will be emptied. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_BUFFER_FLUSH:String = "NetStream.Buffer.Flush"; CONFIG::FLASH_10_1 { /** * This code is sent by the NetStream when the DRM subsystem needs to be * updated. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_DRM_UPDATE:String = "DRM.UpdateNeeded"; } /** * "error" * Flash Media Server only. An error has occurred for a reason other * than those listed in other event codes. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_FAILED:String = "NetStream.Failed"; /** * "status" * Playback has started. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_START:String = "NetStream.Play.Start"; /** * "status" * Playback has stopped. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_STOP:String = "NetStream.Play.Stop"; /** "error" An error has occurred in playback for a reason * other than those listed elsewhere in this table, such as the subscriber not having read access. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_FAILED:String = "NetStream.Play.Failed"; /** * "error" * The FLV passed to the play() method can't be found. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_STREAMNOTFOUND:String = "NetStream.Play.StreamNotFound"; /** * "status" * Caused by a play list reset. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_RESET:String = "NetStream.Play.Reset"; /** * "warning" * Flash Media Server only. The client does not have sufficient bandwidth to play the data at normal speed. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_INSUFFICIENTBW:String = "NetStream.Play.InsufficientBW"; /** "error" * The application detects an invalid file structure and will not try to play this type of file. * For AIR and for Flash Player 9.0.115.0 and later. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_FILESTRUCTUREINVALID:String= "NetStream.Play.FileStructureInvalid"; /** "error" * The application does not detect any supported tracks (video, audio or data) and * will not try to play the file. For AIR and for Flash Player 9.0.115.0 and later. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_NOSUPPORTEDTRACKFOUND:String= "NetStream.Play.NoSupportedTrackFound"; /** * "status" * Flash Media Server 3.5 and later only. The server received the command to transition to another stream * as a result of bitrate stream switching. This code indicates a success status event for the NETSTREAM_play2() * call to initiate a stream switch. If the switch does not succeed, the server sends a NETSTREAM_PLAY.Failed event instead. * When the stream switch occurs, an onPlayStatus event with a code of "NetStream.Play.TransitionComplete" is dispatched. * For Flash Player 10 and later. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_TRANSITION:String = "NetStream.Play.Transition"; /** * "status" * The stream is paused. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PAUSE_NOTIFY:String = "NetStream.Pause.Notify"; /** * "status" * The initial publish to a stream is sent to all subscribers. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_PUBLISH_NOTIFY:String = "NetStream.Play.PublishNotify"; /** * "status" * An unpublish from a stream is sent to all subscribers. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_UNPUBLISH_NOTIFY:String = "NetStream.Play.UnpublishNotify"; /** * "status" * The stream is resumed. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_UNPAUSE_NOTIFY:String = "NetStream.Unpause.Notify"; /** * "error" * The seek fails, which happens if the stream is not seekable. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_SEEK_FAILED:String = "NetStream.Seek.Failed"; /** * "error" * For video downloaded with progressive download, * the user has tried to seek or play past the end of the video data that has downloaded thus far, * or past the end of the video once the entire file has downloaded. * The message.details property contains a time code that indicates the last valid position to which the user can seek. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_SEEK_INVALIDTIME:String = "NetStream.Seek.InvalidTime"; /** * "status" * The seek operation is complete. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_SEEK_NOTIFY:String = "NetStream.Seek.Notify"; //onPlayStatus /** * "status" * Playback has completed. Fires only for streaming connections. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_COMPLETE:String = "NetStream.Play.Complete"; /** * "status" * The subscriber is switching to a new stream as a result of stream bit-rate switching. Fires only for streaming connections. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_TRANSITION_COMPLETE:String = "NetStream.Play.TransitionComplete"; /** * "status" * The seek operation is started. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 2.0 */ public static const NETSTREAM_SEEK_START:String = "NetStream.Seek.Start"; /** * "status" * Playback reached the end of live content, but the stream is not done. Fires only for streaming connections. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_LIVE_STALL:String = "NetStream.Play.LiveStall"; /** * "status" * Playback was previously stalled and has now unstalled. Fires only for streaming connections. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const NETSTREAM_PLAY_LIVE_RESUME:String = "NetStream.Play.LiveResume"; // NetStream events /** * Dispatched when the application receives descriptive information embedded in the video being played. * For information about video file formats supported by Flash Media Server, see the Flash Media Server documentation. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const ON_META_DATA:String = "onMetaData"; /** * Establishes a listener to respond when an embedded cue point is reached while playing a video file. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const ON_CUE_POINT:String = "onCuePoint"; /** * * Establishes a listener to respond when a NetStream object has completely played a stream. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const ON_PLAY_STATUS:String = "onPlayStatus"; } }
Add OSMF NetStreamCodes to com.castlabs.dash.utils package
Add OSMF NetStreamCodes to com.castlabs.dash.utils package
ActionScript
mpl-2.0
XamanSoft/dashas,XamanSoft/dashas,XamanSoft/dashas
4700de0b437e1351b621a0e8298b5897b4e51388
generator/sources/as3/com/kaltura/delegates/WebDelegateBase.as
generator/sources/as3/com/kaltura/delegates/WebDelegateBase.as
// =================================================================================================== // _ __ _ _ // | |/ /__ _| | |_ _ _ _ _ __ _ // | ' </ _` | | _| || | '_/ _` | // |_|\_\__,_|_|\__|\_,_|_| \__,_| // // This file is part of the Kaltura Collaborative Media Suite which allows users // to do with audio, video, and animation what Wiki platfroms allow them to do with // text. // // Copyright (C) 2006-2011 Kaltura Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // // @ignore // =================================================================================================== package com.kaltura.delegates { import com.kaltura.config.IKalturaConfig; import com.kaltura.config.KalturaConfig; import com.kaltura.core.KClassFactory; import com.kaltura.errors.KalturaError; import com.kaltura.events.KalturaEvent; import com.kaltura.net.KalturaCall; import com.kaltura.encryption.MD5; import flash.events.ErrorEvent; import flash.events.Event; import flash.events.EventDispatcher; import flash.events.HTTPStatusEvent; import flash.events.IOErrorEvent; import flash.events.SecurityErrorEvent; import flash.events.TimerEvent; import flash.net.FileReference; import flash.net.URLLoader; import flash.net.URLLoaderDataFormat; import flash.net.URLRequest; import flash.net.URLRequestMethod; import flash.utils.Timer; import flash.utils.getDefinitionByName; public class WebDelegateBase extends EventDispatcher implements IKalturaCallDelegate { public static var CONNECT_TIME:int = 60000; //60 secs public static var LOAD_TIME:int = 60000; //60 secs protected var connectTimer:Timer; protected var loadTimer:Timer; protected var _call:KalturaCall; protected var _config:KalturaConfig; protected var loader:URLLoader; protected var fileRef:FileReference; //Setters & getters public function get call():KalturaCall { return _call; } public function set call(newVal:KalturaCall):void { _call = newVal; } public function get config():IKalturaConfig { return _config; } public function set config(newVal:IKalturaConfig):void { _config = newVal as KalturaConfig; } public function WebDelegateBase(call:KalturaCall = null, config:KalturaConfig = null) { this.call = call; this.config = config; if (!call) return; //maybe a multi request if (call.useTimeout) { connectTimer = new Timer(CONNECT_TIME, 1); connectTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onConnectTimeout); loadTimer = new Timer(LOAD_TIME, 1); loadTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onLoadTimeOut); } execute(); } public function close():void { try { loader.close(); } catch (e:*) { } if (call.useTimeout) { connectTimer.stop(); loadTimer.stop(); } } protected function onConnectTimeout(event:TimerEvent):void { var kError:KalturaError = new KalturaError(); //kError.errorCode = kError.errorMsg = "Connection Timeout: " + CONNECT_TIME / 1000 + " sec with no post command from kaltura client."; _call.handleError(kError); dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); loadTimer.stop(); close(); } protected function onLoadTimeOut(event:TimerEvent):void { connectTimer.stop(); close(); var kError:KalturaError = new KalturaError(); kError.errorMsg = "Post Timeout: " + LOAD_TIME / 1000 + " sec with no post result."; _call.handleError(kError); dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); } protected function execute():void { if (call == null) { throw new Error('No call defined.'); } post(); //post the call } /** * Helper function for sending the call straight to the server */ protected function post():void { addOptionalArguments(); formatRequest(); sendRequest(); if (call.useTimeout) { connectTimer.start(); } } protected function formatRequest():void { //The configuration is stronger then the args if (_config.partnerId != null && _call.args["partnerId"] == -1) _call.setRequestArgument("partnerId", _config.partnerId); if (_config.ks != null) _call.setRequestArgument("ks", _config.ks); if (_config.clientTag != null) _call.setRequestArgument("clientTag", _config.clientTag); _call.setRequestArgument("ignoreNull", _config.ignoreNull); //Create signature hash. //call.setRequestArgument("kalsig", getMD5Checksum(call)); } protected function getMD5Checksum(call:KalturaCall):String { var props:Array = new Array(); for each (var prop:String in call.args) props.push(prop); props.push("service"); props.push("action"); props.sort(); var s:String; for each (prop in props) { s += prop; if (prop == "service") s += call.service; else if (prop == "action") s += call.action; else s += call.args[prop]; } return MD5.encrypt(s); } protected function sendRequest():void { //construct the loader createURLLoader(); //Create signature hash. var kalsig:String = getMD5Checksum(call); //create the service request for normal calls var url:String = _config.protocol + _config.domain + "/" + _config.srvUrl + "?service=" + call.service + "&action=" + call.action + "&kalsig=" + kalsig;; if (_call.method == URLRequestMethod.GET) url += "&"; var req:URLRequest = new URLRequest(url); req.contentType = "application/x-www-form-urlencoded"; req.method = call.method; req.data = call.args; loader.dataFormat = URLLoaderDataFormat.TEXT; loader.load(req); } protected function createURLLoader():void { loader = new URLLoader(); loader.addEventListener(Event.COMPLETE, onDataComplete); loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus); loader.addEventListener(IOErrorEvent.IO_ERROR, onError); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError); loader.addEventListener(Event.OPEN, onOpen); } protected function onHTTPStatus(event:HTTPStatusEvent):void { } protected function onOpen(event:Event):void { if (call.useTimeout) { connectTimer.stop(); loadTimer.start(); } } protected function addOptionalArguments():void { //add optional args here } // Event Handlers protected function onDataComplete(event:Event):void { try { handleResult(XML(event.target.data)); } catch (e:Error) { var kErr:KalturaError = new KalturaError(); kErr.errorCode = String(e.errorID); kErr.errorMsg = e.message; _call.handleError(kErr); } } protected function onError(event:ErrorEvent):void { clean(); var kError:KalturaError = createKalturaError(event, loader.data); if (!kError) { kError.errorMsg = event.text; //kError.errorCode; } call.handleError(kError); dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); } /** * parse the server's response and let the call process it. * @param result server's response */ protected function handleResult(result:XML):void { clean(); var error:KalturaError = validateKalturaResponse(result); if (error == null) { var digestedResult:Object = parse(result); call.handleResult(digestedResult); } else { call.handleError(error); } } /** * stop timers and clean event listeners */ protected function clean():void { if (call.useTimeout) { connectTimer.stop(); loadTimer.stop(); } if (loader == null) { return; } loader.removeEventListener(Event.COMPLETE, onDataComplete); loader.removeEventListener(IOErrorEvent.IO_ERROR, onError); loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, onError); loader.removeEventListener(Event.OPEN, onOpen); } /** * create the correct object and populate it with the given values. if the needed class is not found * in the file, a generic object is created with attributes matching the XML attributes. * Override this parssing function in the specific delegate to create the correct object. * @param result instance attributes * @return an instance of the class declared by the given XML. * */ public function parse(result:XML):* { //by defualt create the response object var cls:Class; try { cls = getDefinitionByName('com.kaltura.vo.' + result.result.objectType) as Class; } catch (e:Error) { cls = Object; } var obj:* = (new KClassFactory(cls)).newInstanceFromXML(result.result); return obj; } /** * If the result string holds an error, return a KalturaError object with * relevant values. <br/> * Overide this to create validation object and fill it. * @param result the string returned from the server. * @return matching error object */ protected function validateKalturaResponse(result:String):KalturaError { var kError:KalturaError = null; var xml:XML = XML(result); if (xml.result.hasOwnProperty('error')) { kError = new KalturaError(); kError.errorCode = String(xml.result.error.code); kError.errorMsg = xml.result.error.message; dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); } return kError; } //Overide this to create error object and fill it protected function createKalturaError(event:ErrorEvent, loaderData:*):KalturaError { var ke:KalturaError = new KalturaError(); return ke; } /** * create the url that is used for serve actions * @param call the KalturaCall that defines the required parameters * @return URLRequest with relevant parameters * */ public function getServeUrl(call:KalturaCall):URLRequest { var url:String = _config.protocol + _config.domain + "/" + _config.srvUrl + "?service=" + call.service + "&action=" + call.action; for (var key:String in call.args) { url += "&" + key + "=" + call.args[key]; } var req:URLRequest = new URLRequest(url); req.contentType = "application/x-www-form-urlencoded"; req.method = call.method; // req.data = call.args; return req; } } }
// =================================================================================================== // _ __ _ _ // | |/ /__ _| | |_ _ _ _ _ __ _ // | ' </ _` | | _| || | '_/ _` | // |_|\_\__,_|_|\__|\_,_|_| \__,_| // // This file is part of the Kaltura Collaborative Media Suite which allows users // to do with audio, video, and animation what Wiki platfroms allow them to do with // text. // // Copyright (C) 2006-2011 Kaltura Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // // @ignore // =================================================================================================== package com.kaltura.delegates { import com.kaltura.config.IKalturaConfig; import com.kaltura.config.KalturaConfig; import com.kaltura.core.KClassFactory; import com.kaltura.errors.KalturaError; import com.kaltura.events.KalturaEvent; import com.kaltura.net.KalturaCall; import com.kaltura.encryption.MD5; import flash.events.ErrorEvent; import flash.events.Event; import flash.events.EventDispatcher; import flash.events.HTTPStatusEvent; import flash.events.IOErrorEvent; import flash.events.SecurityErrorEvent; import flash.events.TimerEvent; import flash.net.FileReference; import flash.net.URLLoader; import flash.net.URLLoaderDataFormat; import flash.net.URLRequest; import flash.net.URLRequestMethod; import flash.utils.Timer; import flash.utils.getDefinitionByName; public class WebDelegateBase extends EventDispatcher implements IKalturaCallDelegate { public static var CONNECT_TIME:int = 60000; //60 secs public static var LOAD_TIME:int = 120000; //120 secs protected var connectTimer:Timer; protected var loadTimer:Timer; protected var _call:KalturaCall; protected var _config:KalturaConfig; protected var loader:URLLoader; protected var fileRef:FileReference; //Setters & getters public function get call():KalturaCall { return _call; } public function set call(newVal:KalturaCall):void { _call = newVal; } public function get config():IKalturaConfig { return _config; } public function set config(newVal:IKalturaConfig):void { _config = newVal as KalturaConfig; } public function WebDelegateBase(call:KalturaCall = null, config:KalturaConfig = null) { this.call = call; this.config = config; if (!call) return; //maybe a multi request if (call.useTimeout) { connectTimer = new Timer(CONNECT_TIME, 1); connectTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onConnectTimeout); loadTimer = new Timer(LOAD_TIME, 1); loadTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onLoadTimeOut); } execute(); } public function close():void { try { loader.close(); } catch (e:*) { } if (call.useTimeout) { connectTimer.stop(); loadTimer.stop(); } } protected function onConnectTimeout(event:TimerEvent):void { var kError:KalturaError = new KalturaError(); kError.errorCode = "KMC_CONNECTION_TIMEOUT"; kError.errorMsg = "Connection Timeout: " + CONNECT_TIME / 1000 + " sec with no post command from kaltura client."; _call.handleError(kError); dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); loadTimer.stop(); close(); } protected function onLoadTimeOut(event:TimerEvent):void { connectTimer.stop(); close(); var kError:KalturaError = new KalturaError(); kError.errorCode = "KMC_POST_TIMEOUT"; kError.errorMsg = "Post Timeout: " + LOAD_TIME / 1000 + " sec with no post result."; _call.handleError(kError); dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); } protected function execute():void { if (call == null) { throw new Error('No call defined.'); } post(); //post the call } /** * Helper function for sending the call straight to the server */ protected function post():void { addOptionalArguments(); formatRequest(); sendRequest(); if (call.useTimeout) { connectTimer.start(); } } protected function formatRequest():void { //The configuration is stronger then the args if (_config.partnerId != null && _call.args["partnerId"] == -1) _call.setRequestArgument("partnerId", _config.partnerId); if (_config.ks != null) _call.setRequestArgument("ks", _config.ks); if (_config.clientTag != null) _call.setRequestArgument("clientTag", _config.clientTag); _call.setRequestArgument("ignoreNull", _config.ignoreNull); //Create signature hash. //call.setRequestArgument("kalsig", getMD5Checksum(call)); } protected function getMD5Checksum(call:KalturaCall):String { var props:Array = new Array(); for each (var prop:String in call.args) props.push(prop); props.push("service"); props.push("action"); props.sort(); var s:String; for each (prop in props) { s += prop; if (prop == "service") s += call.service; else if (prop == "action") s += call.action; else s += call.args[prop]; } return MD5.encrypt(s); } protected function sendRequest():void { //construct the loader createURLLoader(); //Create signature hash. var kalsig:String = getMD5Checksum(call); //create the service request for normal calls var url:String = _config.protocol + _config.domain + "/" + _config.srvUrl + "?service=" + call.service + "&action=" + call.action + "&kalsig=" + kalsig;; if (_call.method == URLRequestMethod.GET) url += "&"; var req:URLRequest = new URLRequest(url); req.contentType = "application/x-www-form-urlencoded"; req.method = call.method; req.data = call.args; loader.dataFormat = URLLoaderDataFormat.TEXT; loader.load(req); } protected function createURLLoader():void { loader = new URLLoader(); loader.addEventListener(Event.COMPLETE, onDataComplete); loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus); loader.addEventListener(IOErrorEvent.IO_ERROR, onError); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError); loader.addEventListener(Event.OPEN, onOpen); } protected function onHTTPStatus(event:HTTPStatusEvent):void { } protected function onOpen(event:Event):void { if (call.useTimeout) { connectTimer.stop(); loadTimer.start(); } } protected function addOptionalArguments():void { //add optional args here } // Event Handlers protected function onDataComplete(event:Event):void { try { handleResult(XML(event.target.data)); } catch (e:Error) { var kErr:KalturaError = new KalturaError(); kErr.errorCode = String(e.errorID); kErr.errorMsg = e.message; _call.handleError(kErr); } } protected function onError(event:ErrorEvent):void { clean(); var kError:KalturaError = createKalturaError(event, loader.data); if (!kError) { kError.errorMsg = event.text; //kError.errorCode; } call.handleError(kError); dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); } /** * parse the server's response and let the call process it. * @param result server's response */ protected function handleResult(result:XML):void { clean(); var error:KalturaError = validateKalturaResponse(result); if (error == null) { var digestedResult:Object = parse(result); call.handleResult(digestedResult); } else { call.handleError(error); } } /** * stop timers and clean event listeners */ protected function clean():void { if (call.useTimeout) { connectTimer.stop(); loadTimer.stop(); } if (loader == null) { return; } loader.removeEventListener(Event.COMPLETE, onDataComplete); loader.removeEventListener(IOErrorEvent.IO_ERROR, onError); loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, onError); loader.removeEventListener(Event.OPEN, onOpen); } /** * create the correct object and populate it with the given values. if the needed class is not found * in the file, a generic object is created with attributes matching the XML attributes. * Override this parssing function in the specific delegate to create the correct object. * @param result instance attributes * @return an instance of the class declared by the given XML. * */ public function parse(result:XML):* { //by defualt create the response object var cls:Class; try { cls = getDefinitionByName('com.kaltura.vo.' + result.result.objectType) as Class; } catch (e:Error) { cls = Object; } var obj:* = (new KClassFactory(cls)).newInstanceFromXML(result.result); return obj; } /** * If the result string holds an error, return a KalturaError object with * relevant values. <br/> * Overide this to create validation object and fill it. * @param result the string returned from the server. * @return matching error object */ protected function validateKalturaResponse(result:String):KalturaError { var kError:KalturaError = null; var xml:XML = XML(result); if (xml.result.hasOwnProperty('error')) { kError = new KalturaError(); kError.errorCode = String(xml.result.error.code); kError.errorMsg = xml.result.error.message; dispatchEvent(new KalturaEvent(KalturaEvent.FAILED, false, false, false, null, kError)); } return kError; } //Overide this to create error object and fill it protected function createKalturaError(event:ErrorEvent, loaderData:*):KalturaError { var ke:KalturaError = new KalturaError(); return ke; } /** * create the url that is used for serve actions * @param call the KalturaCall that defines the required parameters * @return URLRequest with relevant parameters * */ public function getServeUrl(call:KalturaCall):URLRequest { var url:String = _config.protocol + _config.domain + "/" + _config.srvUrl + "?service=" + call.service + "&action=" + call.action; for (var key:String in call.args) { url += "&" + key + "=" + call.args[key]; } var req:URLRequest = new URLRequest(url); req.contentType = "application/x-www-form-urlencoded"; req.method = call.method; // req.data = call.args; return req; } } }
set FlexClient timeout to 120 secs, add error codes to timeout errors
fwr: set FlexClient timeout to 120 secs, add error codes to timeout errors git-svn-id: 8a2ccb88241e16c78017770bc38d91d6d5396a5a@86267 6b8eccd3-e8c5-4e7d-8186-e12b5326b719
ActionScript
agpl-3.0
gale320/server,gale320/server,ivesbai/server,DBezemer/server,kaltura/server,gale320/server,ivesbai/server,gale320/server,doubleshot/server,DBezemer/server,ratliff/server,doubleshot/server,jorgevbo/server,gale320/server,kaltura/server,doubleshot/server,DBezemer/server,ratliff/server,jorgevbo/server,ratliff/server,ratliff/server,jorgevbo/server,DBezemer/server,ivesbai/server,matsuu/server,matsuu/server,jorgevbo/server,ivesbai/server,ivesbai/server,kaltura/server,DBezemer/server,ivesbai/server,DBezemer/server,doubleshot/server,ratliff/server,doubleshot/server,ivesbai/server,matsuu/server,matsuu/server,gale320/server,matsuu/server,jorgevbo/server,ratliff/server,gale320/server,jorgevbo/server,jorgevbo/server,kaltura/server,matsuu/server,doubleshot/server,ratliff/server,jorgevbo/server,doubleshot/server,gale320/server,DBezemer/server,kaltura/server,ivesbai/server,doubleshot/server,DBezemer/server,ratliff/server,matsuu/server,matsuu/server,kaltura/server
da113bebedd55e245527c41d507e7a0f4af97893
swfcat.as
swfcat.as
package { import flash.display.Sprite; import flash.text.TextField; import flash.net.XMLSocket; public class swfcat extends Sprite { private var output_text:TextField; private function puts(s:String):void { output_text.appendText(s + "\n"); } public function swfcat() { output_text = new TextField(); output_text.width = 400; output_text.height = 300; output_text.background = true; output_text.backgroundColor = 0x001f0f; output_text.textColor = 0x44CC44; addChild(output_text); } } }
Add a simple terminal-like output.
Add a simple terminal-like output.
ActionScript
mit
glamrock/flashproxy,infinity0/flashproxy,glamrock/flashproxy,arlolra/flashproxy,arlolra/flashproxy,arlolra/flashproxy,infinity0/flashproxy,infinity0/flashproxy,glamrock/flashproxy,infinity0/flashproxy,infinity0/flashproxy,arlolra/flashproxy,arlolra/flashproxy,arlolra/flashproxy,glamrock/flashproxy,glamrock/flashproxy,arlolra/flashproxy,infinity0/flashproxy,glamrock/flashproxy
82768ec1468846f7e6498bbb8bc0fbd20ab53788
tests/examplefiles/as3_test.as
tests/examplefiles/as3_test.as
import flash.events.MouseEvent; import com.example.programmingas3.playlist.PlayList; import com.example.programmingas3.playlist.Song; import com.example.programmingas3.playlist.SortProperty; // constants for the different "states" of the song form private static const ADD_SONG:uint = 1; private static const SONG_DETAIL:uint = 2; private var playList:PlayList = new PlayList(); private function initApp():void { // set the initial state of the song form, for adding a new song setFormState(ADD_SONG); // prepopulate the list with a few songs playList.addSong(new Song("Nessun Dorma", "Luciano Pavarotti", 1990, "nessundorma.mp3", ["90's", "Opera"])); playList.addSong(new Song("Come Undone", "Duran Duran", 1993, "comeundone.mp3", ["90's", "Pop"])); playList.addSong(new Song("Think of Me", "Sarah Brightman", 1987, "thinkofme.mp3", ["Showtunes"])); playList.addSong(new Song("Unbelievable", "EMF", 1991, "unbelievable.mp3", ["90's", "Pop"])); songList.dataProvider = playList.songList; } private function sortList(sortField:SortProperty):void { // Make all the sort type buttons enabled. // The active one will be grayed-out below sortByTitle.selected = false; sortByArtist.selected = false; sortByYear.selected = false; switch (sortField) { case SortProperty.TITLE: sortByTitle.selected = true; break; case SortProperty.ARTIST: sortByArtist.selected = true; break; case SortProperty.YEAR: sortByYear.selected = true; break; } playList.sortList(sortField); refreshList(); } private function refreshList():void { // remember which song was selected var selectedSong:Song = Song(songList.selectedItem); // re-assign the song list as the dataprovider to get the newly sorted list // and force the List control to refresh itself songList.dataProvider = playList.songList; // reset the song selection if (selectedSong != null) { songList.selectedItem = selectedSong; } } private function songSelectionChange():void { if (songList.selectedIndex != -1) { setFormState(SONG_DETAIL); } else { setFormState(ADD_SONG); } } private function addNewSong():void { // gather the values from the form and add the new song var title:String = newSongTitle.text; var artist:String = newSongArtist.text; var year:uint = newSongYear.value; var filename:String = newSongFilename.text; var genres:Array = newSongGenres.selectedItems; playList.addSong(new Song(title, artist, year, filename, genres)); refreshList(); // clear out the "add song" form fields setFormState(ADD_SONG); } private function songListLabel(item:Object):String { return item.toString(); } private function setFormState(state:uint):void { // set the form title and control state switch (state) { case ADD_SONG: formTitle.text = "Add New Song"; // show the submit button submitSongData.visible = true; showAddControlsBtn.visible = false; // clear the form fields newSongTitle.text = ""; newSongArtist.text = ""; newSongYear.value = (new Date()).fullYear; newSongFilename.text = ""; newSongGenres.selectedIndex = -1; // deselect the currently selected song (if any) songList.selectedIndex = -1; break; case SONG_DETAIL: formTitle.text = "Song Details"; // populate the form with the selected item's data var selectedSong:Song = Song(songList.selectedItem); newSongTitle.text = selectedSong.title; newSongArtist.text = selectedSong.artist; newSongYear.value = selectedSong.year; newSongFilename.text = selectedSong.filename; newSongGenres.selectedItems = selectedSong.genres; // hide the submit button submitSongData.visible = false; showAddControlsBtn.visible = true; break; } }
Add AS3 example.
Add AS3 example.
ActionScript
bsd-2-clause
spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments
8cf25030b38878b3675c839ea807c73c0918ccc9
dolly-framework/src/main/actionscript/dolly/Cloner.as
dolly-framework/src/main/actionscript/dolly/Cloner.as
package dolly { public class Cloner { public function Cloner() { } } }
Create empty Cloner class.
Create empty Cloner class.
ActionScript
mit
Yarovoy/dolly
7b13e12a49a2f4381d493ee6ec221e8e98ea1f8a
src/aerys/minko/render/material/phong/AmbientShader.as
src/aerys/minko/render/material/phong/AmbientShader.as
package aerys.minko.render.material.phong { import aerys.minko.render.RenderTarget; import aerys.minko.render.material.basic.BasicShader; import aerys.minko.render.shader.SFloat; import aerys.minko.render.shader.ShaderSettings; import aerys.minko.render.shader.part.phong.PhongShaderPart; import aerys.minko.type.enum.Blending; public class AmbientShader extends BasicShader { private var _phong : PhongShaderPart; public function AmbientShader(renderTarget : RenderTarget = null, priority : Number = 0.0) { super(renderTarget, priority); _phong = new PhongShaderPart(this); } override protected function initializeSettings(settings:ShaderSettings):void { super.initializeSettings(settings); settings.blending = Blending.OPAQUE; } override protected function getPixelColor() : SFloat { var diffuse : SFloat = super.getPixelColor(); return float4(multiply(diffuse.rgb, _phong.getAmbientLighting()), diffuse.a); } } }
add missing AmbientShader
add missing AmbientShader
ActionScript
mit
aerys/minko-as3
faf14117489517936cc4edc3ba49103ddcea579f
src/org/swiftsuspenders/Injector.as
src/org/swiftsuspenders/Injector.as
/* * Copyright (c) 2009-2011 the original author or authors * * Permission is hereby granted to use, modify, and distribute this file * in accordance with the terms of the license agreement accompanying it. */ package org.swiftsuspenders { import flash.system.ApplicationDomain; import flash.utils.Dictionary; import flash.utils.getQualifiedClassName; import org.swiftsuspenders.injectionpoints.InjectionPoint; import org.swiftsuspenders.injectionpoints.InjectionPointConfig; import org.swiftsuspenders.utils.ClassDescription; import org.swiftsuspenders.utils.ClassDescriptor; import org.swiftsuspenders.utils.SsInternal; import org.swiftsuspenders.utils.getConstructor; use namespace SsInternal; public class Injector { //---------------------- Private / Protected Properties ----------------------// private static var INJECTION_POINTS_CACHE : Dictionary = new Dictionary(true); private var _parentInjector : Injector; private var _applicationDomain:ApplicationDomain; private var _classDescriptor : ClassDescriptor; private var _mappings : Dictionary; private var _namedInjectionsManager : NamedInjectionsManager; //---------------------- Public Methods ----------------------// public function Injector() { _mappings = new Dictionary(); _namedInjectionsManager = new NamedInjectionsManager(this); _classDescriptor = new ClassDescriptor(INJECTION_POINTS_CACHE); } public function map(dependency : Class) : InjectionRule { return _mappings[dependency] ||= createRule(dependency); } public function unmap(dependency : Class) : void { var rule : InjectionRule = _mappings[dependency]; if (!rule) { throw new InjectorError('Error while removing an injector mapping: ' + 'No rule defined for dependency ' + getQualifiedClassName(dependency)); } rule.setProvider(null); } /** * Indicates whether the injector can supply a response for the specified dependency either * by using a rule mapped directly on itself or by querying one of its ancestor injectors. * * @param dependency The dependency under query * @return <code>true</code> if the dependency can be satisfied, <code>false</code> if not */ public function satisfies(dependency : Class) : Boolean { var rule : InjectionRule = getMapping(dependency); return rule && rule.hasProvider(); } /** * Indicates whether the injector can directly supply a response for the specified * dependency * * In contrast to <code>satisfies</code>, <code>satisfiesDirectly</code> only informs * about rules mapped directly on itself, without querying its ancestor injectors. * * @param dependency The dependency under query * @return <code>true</code> if the dependency can be satisfied, <code>false</code> if not */ public function satisfiesDirectly(dependency : Class) : Boolean { var rule : InjectionRule = _mappings[dependency]; return rule && rule.hasProvider(); } /** * Returns the rule mapped to the specified dependency class * * Note that getRule will only return rules mapped in exactly this injector, not ones * mapped in an ancestor injector. To get rules from ancestor injectors, query them using * <code>parentInjector</code>. * This restriction is in place to prevent accidential changing of rules in ancestor * injectors where only the child's response is meant to be altered. * * @param dependency The dependency to return the mapped rule for * @return The rule mapped to the specified dependency class * @throws InjectorError when no rule was found for the specified dependency */ public function getRule(dependency : Class) : InjectionRule { var rule : InjectionRule = _mappings[dependency]; if (!rule) { throw new InjectorError('Error while retrieving an injector mapping: ' + 'No rule defined for dependency ' + getQualifiedClassName(dependency)); } return rule; } public function injectInto(target : Object) : void { var injecteeDescription : ClassDescription = _classDescriptor.getDescription(getConstructor(target)); var injectionPoints : Array = injecteeDescription.injectionPoints; var length : int = injectionPoints.length; for (var i : int = 0; i < length; i++) { var injectionPoint : InjectionPoint = injectionPoints[i]; injectionPoint.applyInjection(target, this); } } public function getInstance(type : Class) : * { var mapping : InjectionRule = getMapping(type); if (!mapping || !mapping.hasProvider()) { return instantiateUnmapped(type); } return mapping.apply(this); } public function createChildInjector(applicationDomain : ApplicationDomain = null) : Injector { var injector : Injector = new Injector(); injector.applicationDomain = applicationDomain; injector.parentInjector = this; return injector; } public function set parentInjector(parentInjector : Injector) : void { _parentInjector = parentInjector; } public function get parentInjector() : Injector { return _parentInjector; } public function set applicationDomain(applicationDomain : ApplicationDomain) : void { _applicationDomain = applicationDomain; } public function get applicationDomain() : ApplicationDomain { return _applicationDomain ? _applicationDomain : ApplicationDomain.currentDomain; } public function usingName(name : String) : NamedInjectionsManager { _namedInjectionsManager.setRequestName(name); return _namedInjectionsManager; } //---------------------- Internal Methods ----------------------// SsInternal static function purgeInjectionPointsCache() : void { INJECTION_POINTS_CACHE = new Dictionary(true); } SsInternal function getMapping(requestType : Class) : InjectionRule { return _mappings[requestType] || getAncestorMapping(requestType); } SsInternal function getAncestorMapping(whenAskedFor : Class) : InjectionRule { return _parentInjector ? _parentInjector.getMapping(whenAskedFor) : null; } SsInternal function getRuleForInjectionPointConfig( config : InjectionPointConfig) : InjectionRule { var type : Class = Class(applicationDomain.getDefinition(config.typeName)); if (config.injectionName) { return usingName(config.injectionName).getMapping(type); } return getMapping(type); } SsInternal function instantiateUnmapped(type : Class) : * { var typeDescription : ClassDescription = _classDescriptor.getDescription(type); var injectionPoint : InjectionPoint = typeDescription.ctor; if (!injectionPoint) { throw new InjectorError("Can't instantiate interface " + getQualifiedClassName(type)); } var instance : * = injectionPoint.applyInjection(type, this); injectInto(instance); return instance; } //---------------------- Private / Protected Methods ----------------------// private function createRule(requestType : Class) : InjectionRule { return new InjectionRule(this, requestType); } } }
/* * Copyright (c) 2009-2011 the original author or authors * * Permission is hereby granted to use, modify, and distribute this file * in accordance with the terms of the license agreement accompanying it. */ package org.swiftsuspenders { import flash.system.ApplicationDomain; import flash.utils.Dictionary; import flash.utils.getQualifiedClassName; import org.swiftsuspenders.injectionpoints.InjectionPoint; import org.swiftsuspenders.injectionpoints.InjectionPointConfig; import org.swiftsuspenders.utils.ClassDescription; import org.swiftsuspenders.utils.ClassDescriptor; import org.swiftsuspenders.utils.SsInternal; import org.swiftsuspenders.utils.getConstructor; use namespace SsInternal; public class Injector { //---------------------- Private / Protected Properties ----------------------// private static var INJECTION_POINTS_CACHE : Dictionary = new Dictionary(true); private var _parentInjector : Injector; private var _applicationDomain:ApplicationDomain; private var _classDescriptor : ClassDescriptor; private var _mappings : Dictionary; private var _namedInjectionsManager : NamedInjectionsManager; //---------------------- Public Methods ----------------------// public function Injector() { _mappings = new Dictionary(); _namedInjectionsManager = new NamedInjectionsManager(this); _classDescriptor = new ClassDescriptor(INJECTION_POINTS_CACHE); _applicationDomain = ApplicationDomain.currentDomain; } public function map(dependency : Class) : InjectionRule { return _mappings[dependency] ||= createRule(dependency); } public function unmap(dependency : Class) : void { var rule : InjectionRule = _mappings[dependency]; if (!rule) { throw new InjectorError('Error while removing an injector mapping: ' + 'No rule defined for dependency ' + getQualifiedClassName(dependency)); } rule.setProvider(null); } /** * Indicates whether the injector can supply a response for the specified dependency either * by using a rule mapped directly on itself or by querying one of its ancestor injectors. * * @param dependency The dependency under query * @return <code>true</code> if the dependency can be satisfied, <code>false</code> if not */ public function satisfies(dependency : Class) : Boolean { var rule : InjectionRule = getMapping(dependency); return rule && rule.hasProvider(); } /** * Indicates whether the injector can directly supply a response for the specified * dependency * * In contrast to <code>satisfies</code>, <code>satisfiesDirectly</code> only informs * about rules mapped directly on itself, without querying its ancestor injectors. * * @param dependency The dependency under query * @return <code>true</code> if the dependency can be satisfied, <code>false</code> if not */ public function satisfiesDirectly(dependency : Class) : Boolean { var rule : InjectionRule = _mappings[dependency]; return rule && rule.hasProvider(); } /** * Returns the rule mapped to the specified dependency class * * Note that getRule will only return rules mapped in exactly this injector, not ones * mapped in an ancestor injector. To get rules from ancestor injectors, query them using * <code>parentInjector</code>. * This restriction is in place to prevent accidential changing of rules in ancestor * injectors where only the child's response is meant to be altered. * * @param dependency The dependency to return the mapped rule for * @return The rule mapped to the specified dependency class * @throws InjectorError when no rule was found for the specified dependency */ public function getRule(dependency : Class) : InjectionRule { var rule : InjectionRule = _mappings[dependency]; if (!rule) { throw new InjectorError('Error while retrieving an injector mapping: ' + 'No rule defined for dependency ' + getQualifiedClassName(dependency)); } return rule; } public function injectInto(target : Object) : void { var injecteeDescription : ClassDescription = _classDescriptor.getDescription(getConstructor(target)); var injectionPoints : Array = injecteeDescription.injectionPoints; var length : int = injectionPoints.length; for (var i : int = 0; i < length; i++) { var injectionPoint : InjectionPoint = injectionPoints[i]; injectionPoint.applyInjection(target, this); } } public function getInstance(type : Class) : * { var mapping : InjectionRule = getMapping(type); if (!mapping || !mapping.hasProvider()) { return instantiateUnmapped(type); } return mapping.apply(this); } public function createChildInjector(applicationDomain : ApplicationDomain = null) : Injector { var injector : Injector = new Injector(); injector.applicationDomain = applicationDomain; injector.parentInjector = this; return injector; } public function set parentInjector(parentInjector : Injector) : void { _parentInjector = parentInjector; } public function get parentInjector() : Injector { return _parentInjector; } public function set applicationDomain(applicationDomain : ApplicationDomain) : void { _applicationDomain = applicationDomain || ApplicationDomain.currentDomain; } public function get applicationDomain() : ApplicationDomain { return _applicationDomain; } public function usingName(name : String) : NamedInjectionsManager { _namedInjectionsManager.setRequestName(name); return _namedInjectionsManager; } //---------------------- Internal Methods ----------------------// SsInternal static function purgeInjectionPointsCache() : void { INJECTION_POINTS_CACHE = new Dictionary(true); } SsInternal function getMapping(requestType : Class) : InjectionRule { return _mappings[requestType] || getAncestorMapping(requestType); } SsInternal function getAncestorMapping(whenAskedFor : Class) : InjectionRule { return _parentInjector ? _parentInjector.getMapping(whenAskedFor) : null; } SsInternal function getRuleForInjectionPointConfig( config : InjectionPointConfig) : InjectionRule { var type : Class = Class(applicationDomain.getDefinition(config.typeName)); if (config.injectionName) { return usingName(config.injectionName).getMapping(type); } return getMapping(type); } SsInternal function instantiateUnmapped(type : Class) : * { var typeDescription : ClassDescription = _classDescriptor.getDescription(type); var injectionPoint : InjectionPoint = typeDescription.ctor; if (!injectionPoint) { throw new InjectorError("Can't instantiate interface " + getQualifiedClassName(type)); } var instance : * = injectionPoint.applyInjection(type, this); injectInto(instance); return instance; } //---------------------- Private / Protected Methods ----------------------// private function createRule(requestType : Class) : InjectionRule { return new InjectionRule(this, requestType); } } }
Store ApplicationDomain.currentDomain in Injector#_applicationDomain in case of no explicit domain being set. Turns out that calling ApplicationDomain.currentDomain has a huge cost that can thus be saved in 99.9% of all cases
Store ApplicationDomain.currentDomain in Injector#_applicationDomain in case of no explicit domain being set. Turns out that calling ApplicationDomain.currentDomain has a huge cost that can thus be saved in 99.9% of all cases
ActionScript
mit
tschneidereit/SwiftSuspenders,LordXaoca/SwiftSuspenders,rshiue/swiftsuspenders,rshiue/swiftsuspenders,robotlegs/swiftsuspenders,tschneidereit/SwiftSuspenders,LordXaoca/SwiftSuspenders,robotlegs/swiftsuspenders
1296120dfbeed5d10615f2d574ab5c5d830f4934
src/console.as
src/console.as
package { public class console { public static function log(string: String): void { process.puts(string) } } }
Add console.log.
Add console.log.
ActionScript
mit
dbrock/stdio.as,dbrock/stdio.as,dbrock/stdio.as
1dfd62af2727d0b96f9f09b761e9931250075739
ImpetusChannel.as
ImpetusChannel.as
package io.github.jwhile.impetus { import flash.media.SoundChannel; public class ImpetusChannel { this.channel:SoundChannel; public function ImpetusChannel(channel:SoundChannel):void { this.channel = channel; } } }
Add class ImpetusChannel
Add class ImpetusChannel
ActionScript
mit
Julow/Impetus
05a3f85c4c84a6bbf4a3340a9a2effa790dbbc45
src/corsaair/server/spitfire/SimpleSocketServer.as
src/corsaair/server/spitfire/SimpleSocketServer.as
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package corsaair.server.spitfire { import C.errno.*; import C.arpa.inet.*; import C.netdb.*; import C.netinet.*; import C.sys.socket.*; import C.stdlib.*; import C.unistd.*; import flash.utils.ByteArray; /** * A simple socket server. * * This mainyl show how you use BSD sockets to setup a listenign server, * the server does not have a loop to listen on multiple connections * to deal with numerous clients. * * You run the server, connect to it with telnet or netcat, * the server send a message to the client and then close the connection. * * @see http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#simpleserver A Simple Stream Server */ public class SimpleSocketServer { // the port users will be connecting to public const PORT:String = "3490"; // how many pending connections queue will hold public const BACKLOG:uint = 10; public function SimpleSocketServer() { super(); } /* Note: This is our first server we do the basic and the very raw stuff using BSD sockets with comments :) this code is ported directly from C source code http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#simpleserver from the excellent Beej's Guide to Network Programming Using Internet Sockets */ public function main():void { // listen on sock_fd var sockfd:int; // new connection on new_fd var new_fd:int; var hints:addrinfo = new addrinfo(); var servinfo:addrinfo; /* Note: With BSD sockets the constants are very important it's how we configure everything ai_family = AF_UNSPEC if we want to use either IPv4 or IPv6 ai_family = AF_INET to use only IPv4 ai_family = AF_INET6 to use only IPv6 SOCK_STREAM for TCP (stream) sockets SOCK_DGRAM for UDP (datagram) sockets */ hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; // use my IP /* Note: getaddrinfo() works a bit differently compared to C instead of passing a list by reference and return an int our AS3 getaddrinfo() - return null if an error occured and will fill the details into the CEAIrror object - or return an array of addrinfo found */ var eaierr:CEAIrror = new CEAIrror(); var addrlist:Array = getaddrinfo( null, PORT, hints, eaierr ); if( !addrlist ) { throw eaierr; } var option:int; var bound:int; // loop through all the results and bind to the first we can for( var i:uint = 0; i < addrlist.length; i++ ) { servinfo = addrlist[i]; sockfd = socket( servinfo.ai_family, servinfo.ai_socktype, servinfo.ai_protocol ); if( sockfd == -1 ) { trace( "server: socket" ) trace( new CError( "", errno ) ); continue; } option = setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR, 1 ); if( option == -1 ) { trace( "setsockopt" ); trace( new CError( "", errno ) ); exit( 1 ); } bound = bind( sockfd, servinfo.ai_addr ); if( bound == -1 ) { close( sockfd ); trace( "server: bind" ); trace( new CError( "", errno ) ); continue; } /* Note: If we reach here that means we could open a socket and bind to it */ break; } /* Note: If this happen that means we looped trough all the address of getaddrinfo() but we could not open/bind any of them */ if( servinfo == null ) { trace( "server: failed to bind" ); exit( 1 ); } /* Note: that's the basic of a "socket server" - socket() : Create an endpoint for communication. - bind() : Bind a name to a socket. - listen() : Listen for socket connections and limit the queue of incoming connections. socket() is mainly describing what kind of socket we want to use and then return a file descriptor (the ID of the socket if you want) bind() is here to "connect" the socket ID to a network interface on the same computer you could have different IP address: 127.0.0.1 the localhost 192.168.0.1 the IP adress on your local network 255.165.225.235 the IP adress assigned by your ISP etc. and finally listen() is here to say on which port we want to receive data, or which service port 80 is for HTTP web server port 21 is for FTP server etc. */ var listening:int = listen( sockfd, BACKLOG ); if( listening == -1 ) { trace( "listen" ); trace( new CError( "", errno ) ); exit( 1 ); } trace( "server: waiting for connections..." ); var client_addr:sockaddr_in = new sockaddr_in(); // main accept() loop while( 1 ) { new_fd = accept( sockfd, client_addr ); if( new_fd == -1 ) { trace( "accept" ); trace( new CError( "", errno ) ); continue; } var s:String = inet_ntop( client_addr.sin_family, client_addr ); if( !s ) { trace( "inet_ntop" ); trace( new CError( "", errno ) ); continue; } trace( "server: got connection from " + s ); /* Note: we prepare the message into a ByteArray and send it If you comapre with server.c you will see that we do not use fork() this is on purpose fork() is a very unixy thing that just does not work under Windows, but next example will show how to do like fork() but with Workers :) */ var msg:String = "Hello, world!\n"; var bytes:ByteArray = new ByteArray(); bytes.writeUTFBytes( msg ); bytes.position = 0; var sent:int = send( new_fd, bytes ); if( sent == -1 ) { trace( "send" ); trace( new CError( "", errno ) ); continue; } else { trace( "sent " + sent + " bytes to the client" ); break; } } trace( "disconnecting client" ); close( new_fd ); trace( "shutting down server" ); close( sockfd ); exit( 0 ); } } }
add simple socket server
add simple socket server git-svn-id: 44dac414ef660a76a1e627c7b7c0e36d248d62e4@13 c2cce57b-6cbb-4450-ba62-5fdab5196ef5
ActionScript
mpl-2.0
Corsaair/spitfire
fbaa8d828eec155a817b486f35e8a1e61f9c98e1
src/flash/utils/ObjectOutput.as
src/flash/utils/ObjectOutput.as
/* * Copyright 2014 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package flash.utils { [native(cls='ObjectOutputClass')] internal class ObjectOutput implements IDataOutput { public native function get objectEncoding(): uint; public native function set objectEncoding(version: uint): void; public native function get endian(): String; public native function set endian(type: String): void; public native function writeBytes(bytes: ByteArray, offset: uint = 0, length: uint = 0): void; public native function writeBoolean(value: Boolean): void; public native function writeByte(value: int): void; public native function writeShort(value: int): void; public native function writeInt(value: int): void; public native function writeUnsignedInt(value: uint): void; public native function writeFloat(value: Number): void; public native function writeDouble(value: Number): void; public native function writeMultiByte(value: String, charSet: String): void; public native function writeUTF(value: String): void; public native function writeUTFBytes(value: String): void; public native function writeObject(object: *): void; } }
Add missing builtin flash.utils.ObjectOutput
Add missing builtin flash.utils.ObjectOutput
ActionScript
apache-2.0
mbebenita/shumway,tschneidereit/shumway,yurydelendik/shumway,mozilla/shumway,mozilla/shumway,mbebenita/shumway,mozilla/shumway,mozilla/shumway,yurydelendik/shumway,mbebenita/shumway,tschneidereit/shumway,mozilla/shumway,mbebenita/shumway,yurydelendik/shumway,tschneidereit/shumway,mbebenita/shumway,mozilla/shumway,mbebenita/shumway,yurydelendik/shumway,yurydelendik/shumway,mozilla/shumway,tschneidereit/shumway,yurydelendik/shumway,mbebenita/shumway,tschneidereit/shumway,yurydelendik/shumway,tschneidereit/shumway,mozilla/shumway,tschneidereit/shumway,mbebenita/shumway,tschneidereit/shumway,yurydelendik/shumway
5f68971b5d7f5b1a5ddc194c13ea767f31ccd460
test/org/swiftsuspenders/GetConstructorTests.as
test/org/swiftsuspenders/GetConstructorTests.as
package org.swiftsuspenders { public class GetConstructorTests { /******************************************************************************************* * public properties * *******************************************************************************************/ /******************************************************************************************* * protected/ private properties * *******************************************************************************************/ /******************************************************************************************* * public methods * *******************************************************************************************/ public function GetConstructorTests() { } /******************************************************************************************* * protected/ private methods * *******************************************************************************************/ } }
Refactor Injector#injectInto to fix bug in Reflector#getClass passing Proxy.
Refactor Injector#injectInto to fix bug in Reflector#getClass passing Proxy. Signed-off-by: Till Schneidereit <[email protected]>
ActionScript
mit
tschneidereit/SwiftSuspenders,tschneidereit/SwiftSuspenders,rshiue/swiftsuspenders,rshiue/swiftsuspenders,robotlegs/swiftsuspenders,robotlegs/swiftsuspenders,LordXaoca/SwiftSuspenders,LordXaoca/SwiftSuspenders
6f91a57c1e563d33f4d64083e71810dfd3db9623
src/aerys/minko/render/shader/compiler/ShaderCompilerError.as
src/aerys/minko/render/shader/compiler/ShaderCompilerError.as
package aerys.minko.render.shader.compiler { public final class ShaderCompilerError extends Error { public static const TOO_MANY_VERTEX_OPERATIONS : uint = 1 << 0; public static const TOO_MANY_VERTEX_CONSTANTS : uint = 1 << 1; public static const TOO_MANY_VERTEX_TEMPORARIES : uint = 1 << 2; public static const TOO_MANY_VERTEX_ATTRIBUTES : uint = 1 << 3; public static const TOO_MANY_VARYINGS : uint = 1 << 4; public static const TOO_MANY_FRAGMENT_OPERATIONS : uint = 1 << 5; public static const TOO_MANY_FRAGMENT_CONSTANTS : uint = 1 << 6; public static const TOO_MANY_FRAGMENT_TEMPORARIES : uint = 1 << 7; public static const TOO_MANY_FRAGMENT_SAMPLERS : uint = 1 << 8; public static const OUT_OF_REGISTERS : uint = TOO_MANY_VERTEX_CONSTANTS | TOO_MANY_VERTEX_TEMPORARIES | TOO_MANY_VERTEX_ATTRIBUTES | TOO_MANY_FRAGMENT_CONSTANTS | TOO_MANY_FRAGMENT_TEMPORARIES | TOO_MANY_FRAGMENT_SAMPLERS; public function ShaderCompilerError(id : uint = 0) { super(message, id); } } }
add missing ShaderCompilerError class
add missing ShaderCompilerError class
ActionScript
mit
aerys/minko-as3
e7f44edc14d2e33ab9d3cfcc1fe2cd33b723a263
src/aerys/minko/ns/minko_animation.as
src/aerys/minko/ns/minko_animation.as
// ActionScript file package aerys.minko.ns { public namespace minko_animation; }
Add Animation namespace and modification for timelines
Add Animation namespace and modification for timelines A New namespace to access confidential information inside timelines M Each timeline has two new getter, need namespace minko_animation to use them
ActionScript
mit
aerys/minko-as3
4de8f49ba0a06a5320916ae88dbcaf361c806ab4
dolly-framework/src/test/actionscript/dolly/CopyingOfPropertyLevelCopyableClassTest.as
dolly-framework/src/test/actionscript/dolly/CopyingOfPropertyLevelCopyableClassTest.as
package dolly { import dolly.core.dolly_internal; import dolly.data.PropertyLevelCopyableClass; import org.as3commons.reflect.Field; import org.as3commons.reflect.Type; import org.flexunit.asserts.assertEquals; import org.flexunit.asserts.assertFalse; import org.flexunit.asserts.assertNotNull; use namespace dolly_internal; public class CopyingOfPropertyLevelCopyableClassTest { private var propertyLevelCopyableClass:PropertyLevelCopyableClass; private var propertyLevelCopyableClassType:Type; [Before] public function before():void { propertyLevelCopyableClass = new PropertyLevelCopyableClass(); propertyLevelCopyableClass.property1 = "property1 value"; propertyLevelCopyableClass.property2 = "property2 value"; propertyLevelCopyableClass.writableField1 = "writableField1 value"; propertyLevelCopyableClassType = Type.forInstance(propertyLevelCopyableClass); } [After] public function after():void { propertyLevelCopyableClass = null; propertyLevelCopyableClassType = null; } [Test] public function findingAllCopyableFieldsForType():void { const copyableFields:Vector.<Field> = Copier.findCopyableFieldsForType(propertyLevelCopyableClassType); assertNotNull(copyableFields); assertEquals(2, copyableFields.length); assertNotNull(copyableFields[0]); assertNotNull(copyableFields[1]); } [Test] public function copyingByCopier():void { const copyInstance:PropertyLevelCopyableClass = Copier.copy(propertyLevelCopyableClass); assertNotNull(copyInstance); assertNotNull(copyInstance.property1); assertEquals(copyInstance.property1, propertyLevelCopyableClass.property1); assertNotNull(copyInstance.property2); assertFalse(copyInstance.property2 == propertyLevelCopyableClass.property2); assertNotNull(copyInstance.writableField1); assertEquals(copyInstance.writableField1, propertyLevelCopyableClass.writableField1); } [Test] public function copyingByCopyFunction():void { const copyInstance:PropertyLevelCopyableClass = copy(propertyLevelCopyableClass); assertNotNull(copyInstance); assertNotNull(copyInstance.property1); assertEquals(copyInstance.property1, propertyLevelCopyableClass.property1); assertNotNull(copyInstance.property2); assertFalse(copyInstance.property2 == propertyLevelCopyableClass.property2); assertNotNull(copyInstance.writableField1); assertEquals(copyInstance.writableField1, propertyLevelCopyableClass.writableField1); } } }
Create new test class: CopyingOfPropertyLevelCopyableClassTest.
Create new test class: CopyingOfPropertyLevelCopyableClassTest.
ActionScript
mit
Yarovoy/dolly
5eb0e85ff67a6480c9fb394773ccf8b125127385
examples/web/app/classes/boot.as
examples/web/app/classes/boot.as
package { import flash.display.Sprite; [SWF(backgroundColor='#000000', frameRate='32', width='720', height='480')] public final class boot extends Sprite { public function boot() { super(); } protected function initialize():void { // N/A yet. } protected function finalize():void { // N/A yet. } public function arrange():void { // N/A yet. } private function removeLoader():void { // N/A yet. } private function ready():void { // N/A yet. } private function progress(event:*):void { // N/A yet. } private function complete(event:*):void { // N/A yet. } private function setup():void { // N/A yet. } private function run():void { removeLoader(); arrange(); } } }
Create boot.as
Create boot.as
ActionScript
apache-2.0
adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler
cde69e8e7ab6d5e78fe3d5ab0b0ead24295570a4
src/com/pivotshare/hls/loader/FragmentDemuxedStream.as
src/com/pivotshare/hls/loader/FragmentDemuxedStream.as
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package com.pivotshare.hls.loader { import flash.display.DisplayObject; import flash.events.*; import flash.net.*; import flash.utils.ByteArray; import flash.utils.getTimer; import flash.utils.Timer; import com.pivotshare.hls.loader.FragmentStream; import org.mangui.hls.constant.HLSLoaderTypes; import org.mangui.hls.demux.Demuxer; import org.mangui.hls.demux.DemuxHelper; import org.mangui.hls.demux.ID3Tag; import org.mangui.hls.event.HLSError; import org.mangui.hls.event.HLSEvent; import org.mangui.hls.event.HLSLoadMetrics; import org.mangui.hls.flv.FLVTag; import org.mangui.hls.HLS; import org.mangui.hls.model.AudioTrack; import org.mangui.hls.model.Fragment; import org.mangui.hls.model.FragmentData; import org.mangui.hls.utils.AES; CONFIG::LOGGING { import org.mangui.hls.utils.Log; import org.mangui.hls.utils.Hex; } /** * HLS Fragment Demuxed Streamer. * Tries to parallel URLStream design pattern, but is incomplete. * * This class encapsulates Demuxing, but in an inefficient way. This is not * meant to be performant for sequential Fragments in play. * * @class FragmentDemuxedStream * @extends EventDispatcher * @author HGPA */ public class FragmentDemuxedStream extends EventDispatcher { /* * DisplayObject needed by AES decrypter. */ private var _displayObject : DisplayObject; /* * Fragment being loaded. */ private var _fragment : Fragment; /* * URLStream used to download current Fragment. */ private var _fragmentStream : FragmentStream; /* * Metrics for this stream. */ private var _metrics : HLSLoadMetrics; /* * Demuxer needed for this Fragment. */ private var _demux : Demuxer; /* * Options for streaming and demuxing. */ private var _options : Object; // // // // Public Methods // // // /** * Create a FragmentStream. * * This constructor takes a reference to main DisplayObject, e.g. stage, * necessary for AES decryption control. * * TODO: It would be more appropriate to create a factory that itself * takes the DisplayObject (or a more flexible version of AES). * * @constructor * @param {DisplayObject} displayObject */ public function FragmentDemuxedStream(displayObject : DisplayObject) : void { _displayObject = displayObject; _fragment = null; _fragmentStream = null; _metrics = null; _demux = null; _options = new Object(); }; /* * Return FragmentData of Fragment currently being downloaded. * Of immediate interest is the `bytes` field. * * @method getFragment * @return {Fragment} */ public function getFragment() : Fragment { return _fragment; } /* * Close the stream. * * @method close */ public function close() : void { if (_fragmentStream) { _fragmentStream.close(); } if (_demux) { _demux.cancel(); _demux = null; } } /** * Load a Fragment. * * This class/methods DOES NOT user reference of parameter. Instead it * clones the Fragment and manipulates this internally. * * @method load * @param {Fragment} fragment - Fragment with details (cloned) * @param {ByteArray} key - Encryption Key * @return {HLSLoadMetrics} */ public function load(fragment : Fragment, key : ByteArray, options : Object) : HLSLoadMetrics { _options = options; // Clone Fragment, with new initilizations of deep fields // Passing around references is what is causing problems. // FragmentData is initialized as part of construction _fragment = new Fragment( fragment.url, fragment.duration, fragment.level, fragment.seqnum, fragment.start_time, fragment.continuity, fragment.program_date, fragment.decrypt_url, fragment.decrypt_iv, // We need this reference fragment.byterange_start_offset, fragment.byterange_end_offset, new Vector.<String>() ) _fragmentStream = new FragmentStream(_displayObject); _fragmentStream.addEventListener(IOErrorEvent.IO_ERROR, onStreamError); _fragmentStream.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onStreamError); _fragmentStream.addEventListener(ProgressEvent.PROGRESS, onStreamProgress); _fragmentStream.addEventListener(Event.COMPLETE, onStreamComplete); CONFIG::LOGGING { var fragmentString : String = "Fragment[" + _fragment.level + "][" + _fragment.seqnum + "]"; Log.debug("FragmentDemuxedStream#load: " + fragmentString); } _metrics = _fragmentStream.load(_fragment, key); return _metrics; } // // // // FragmentStream Event Listeners // // // /** * * @method onFragmentStreamProgress * @param {ProgressEvent} evt */ private function onStreamProgress(evt : ProgressEvent) : void { _fragment = _fragmentStream.getFragment(); CONFIG::LOGGING { var fragmentString : String = "Fragment[" + _fragment.level + "][" + _fragment.seqnum + "]"; Log.debug("FragmentDemuxedStream#onStreamProgress: " + fragmentString + " Progress - " + evt.bytesLoaded + " of " + evt.bytesTotal); Log.debug("FragmentDemuxedStream#onStreamProgress: " + fragmentString + " Fragment status - bytes.position / bytes.length / bytesLoaded " + _fragment.data.bytes.position + " / " + _fragment.data.bytes.length + " / " + _fragment.data.bytesLoaded); } // If we are loading a partial Fragment then only parse when it has // completed loading to desired portion (See onFragmentStreamComplete) /* if (fragment.byterange_start_offset != -1) { return; } */ // START PARSING METRICS if (_metrics.parsing_begin_time == 0) { _metrics.parsing_begin_time = getTimer(); } // Demuxer has not yet been initialized as this is probably first // call to onFragmentStreamProgress, but demuxer may also be/remain // null due to unknown Fragment type. Probe is synchronous. if (_demux == null) { // It is possible we have run onFragmentStreamProgress before // without having sufficient data to probe //bytes.position = bytes.length; //bytes.writeBytes(byteArray); //byteArray = bytes; CONFIG::LOGGING { var fragmentString : String = "Fragment[" + _fragment.level + "][" + _fragment.seqnum + "]"; Log.debug("FragmentDemuxedStream#onStreamProgress: Need a Demuxer for " + fragmentString); } _demux = DemuxHelper.probe( _fragment.data.bytes, null, _onDemuxAudioTrackRequested, _onDemuxProgress, _onDemuxComplete, _onDemuxVideoMetadata, _onDemuxID3TagFound, false ); } if (_demux) { // Demuxer expects the ByteArray delta var byteArray : ByteArray = new ByteArray(); _fragment.data.bytes.readBytes(byteArray, 0, _fragment.data.bytes.length - _fragment.data.bytes.position); byteArray.position = 0; _demux.append(byteArray); } } /** * Called when FragmentStream completes. * * @method onStreamComplete * @param {Event} evt */ private function onStreamComplete(evt : Event) : void { // If demuxer is still null, then the Fragment type was invalid if (_demux == null) { CONFIG::LOGGING { Log.error("FragmentDemuxedStream#onStreamComplete: unknown fragment type"); _fragment.data.bytes.position = 0; var bytes2 : ByteArray = new ByteArray(); _fragment.data.bytes.readBytes(bytes2, 0, 512); Log.debug2("FragmentDemuxedStream#onStreamComplete: frag dump(512 bytes)"); Log.debug2(Hex.fromArray(bytes2)); } var err : ErrorEvent = new ErrorEvent( ErrorEvent.ERROR, false, false, "Unknown Fragment Type" ); dispatchEvent(err); } else { _demux.notifycomplete(); } } /** * Called when FragmentStream has errored. * * @method onStreamError * @param {ProgressEvent} evt */ private function onStreamError(evt : ErrorEvent) : void { CONFIG::LOGGING { Log.error("FragmentDemuxedStream#onStreamError: " + evt.text); } dispatchEvent(evt); } // // // // Demuxer Callbacks // // // /** * Called when Demuxer needs to know which AudioTrack to parse for. * * FIXME: This callback simply returns the first audio track! * We need to pass this class the appropriate callback propogated from * UI layer. Yuck. * * @method _onDemuxAudioTrackRequested * @param {Vector<AudioTrack} audioTrackList - List of AudioTracks * @return {AudioTrack} - AudioTrack to parse */ private function _onDemuxAudioTrackRequested(audioTrackList : Vector.<AudioTrack>) : AudioTrack { if (audioTrackList.length > 0) { return audioTrackList[0]; } else { return null; } } /** * Called when Demuxer parsed portion of Fragment. * * @method _onDemuxProgress * @param {Vector<FLVTag} tags */ private function _onDemuxProgress(tags : Vector.<FLVTag>) : void { CONFIG::LOGGING { Log.debug("FragmentDemuxedStream#_onDemuxProgress"); } _fragment.data.appendTags(tags); // TODO: Options to parse only portion of Fragment // FIXME: bytesLoaded and bytesTotal represent stats of the current // FragmentStream, not Demuxer, which is no longer bytes-relative. // What should we define here? var progressEvent : ProgressEvent = new ProgressEvent( ProgressEvent.PROGRESS, false, false, _fragment.data.bytes.length, // bytesLoaded _fragment.data.bytesTotal // bytesTotal ); dispatchEvent(progressEvent); }; /** * Called when Demuxer has finished parsing Fragment. * * @method _onDemuxComplete */ private function _onDemuxComplete() : void { CONFIG::LOGGING { Log.debug("FragmentDemuxedStream#_onDemuxComplete"); } _metrics.parsing_end_time = getTimer(); var completeEvent : Event = new ProgressEvent(Event.COMPLETE); dispatchEvent(completeEvent); }; /** * Called when Video metadata is parsed. * * Specifically, when Sequence Parameter Set (SPS) is found. * * @method _onDemuxVideoMetadata * @param {uint} width * @param {uint} height */ private function _onDemuxVideoMetadata(width : uint, height : uint) : void { if (_fragment.data.video_width == 0) { CONFIG::LOGGING { Log.debug("FragmentDemuxedStream#_onDemuxVideoMetadata: AVC SPS = " + width + "x" + height); } _fragment.data.video_width = width; _fragment.data.video_height = height; } } /** * Called when ID3 tags are found. * * @method _onDemuxID3TagFound * @param {Vector.<ID3Tag>} id3_tags - ID3 Tags */ private function _onDemuxID3TagFound(id3_tags : Vector.<ID3Tag>) : void { _fragment.data.id3_tags = id3_tags; } } }
Add com.pivotshare.hls.loader.FragmentDemuxedStream
[FragmentDemuxedStream] Add com.pivotshare.hls.loader.FragmentDemuxedStream
ActionScript
mpl-2.0
codex-corp/flashls,codex-corp/flashls
63d8ee220299b21e0cf7b3ccc8db32acc2a18111
src/battlecode/world/signals/TypeChangeSignal.as
src/battlecode/world/signals/TypeChangeSignal.as
package battlecode.world.signals { public class TypeChangeSignal implements Signal { private var robotID:uint; private var type:String; public function TypeChangeSignal(robotID:uint, type:String) { this.robotID = robotID; this.type = type; } public function getRobotID():uint { return robotID; } public function getType():String { return type; } public function accept(handler:SignalHandler):* { return handler.visitTypeChangeSignal(this); } } }
add TypeChangeSignal class
add TypeChangeSignal class
ActionScript
mit
trun/battlecode-webclient
d309f0539165ce6a1603728fa49753daa0f63d3d
flash/org/windmill/TestCase.as
flash/org/windmill/TestCase.as
/* Copyright 2009, Matthew Eernisse ([email protected]) and Slide, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.windmill { import flash.display.Sprite; import flash.display.Stage; import org.windmill.WMAssert; public class TestCase extends Sprite { public var asserts:* = WMAssert; // Get a reference to the Stage in the base class // before the tests actually load so tests can all // reference it private var fakeStage:Stage = Windmill.getStage(); override public function get stage():Stage { return fakeStage; } } }
Test case base class -- all AS test classes extend this.
Test case base class -- all AS test classes extend this.
ActionScript
apache-2.0
windmill/windmill,windmill/windmill,windmill/windmill,windmill/windmill,windmill/windmill,windmill/windmill
0e3d427edcef3904f1f46bd7e53c6b163e985771
unittests/TestEquivalence.as
unittests/TestEquivalence.as
package unittests { public class TestEquivalence { [Before] public function setUp():void { } [After] public function tearDown():void { } [BeforeClass] public static function setUpBeforeClass():void { } [AfterClass] public static function tearDownAfterClass():void { } } }
Add stub class for Equivalence class testing
Add stub class for Equivalence class testing
ActionScript
agpl-3.0
mbjornas3/AGORA,MichaelHoffmann/AGORA,mbjornas3/AGORA,MichaelHoffmann/AGORA,MichaelHoffmann/AGORA
0d86487f42ee5f549bb5cdc63e0e686666ff6e41
tests/examplefiles/as3_test.as
tests/examplefiles/as3_test.as
import flash.events.MouseEvent; import com.example.programmingas3.playlist.PlayList; import com.example.programmingas3.playlist.Song; import com.example.programmingas3.playlist.SortProperty; // constants for the different "states" of the song form private static const ADD_SONG:uint = 1; private static const SONG_DETAIL:uint = 2; private var playList:PlayList = new PlayList(); private function initApp():void { // set the initial state of the song form, for adding a new song setFormState(ADD_SONG); // prepopulate the list with a few songs playList.addSong(new Song("Nessun Dorma", "Luciano Pavarotti", 1990, "nessundorma.mp3", ["90's", "Opera"])); playList.addSong(new Song("Come Undone", "Duran Duran", 1993, "comeundone.mp3", ["90's", "Pop"])); playList.addSong(new Song("Think of Me", "Sarah Brightman", 1987, "thinkofme.mp3", ["Showtunes"])); playList.addSong(new Song("Unbelievable", "EMF", 1991, "unbelievable.mp3", ["90's", "Pop"])); songList.dataProvider = playList.songList; } private function sortList(sortField:SortProperty):void { // Make all the sort type buttons enabled. // The active one will be grayed-out below sortByTitle.selected = false; sortByArtist.selected = false; sortByYear.selected = false; switch (sortField) { case SortProperty.TITLE: sortByTitle.selected = true; break; case SortProperty.ARTIST: sortByArtist.selected = true; break; case SortProperty.YEAR: sortByYear.selected = true; break; } playList.sortList(sortField); refreshList(); } private function refreshList():void { // remember which song was selected var selectedSong:Song = Song(songList.selectedItem); // re-assign the song list as the dataprovider to get the newly sorted list // and force the List control to refresh itself songList.dataProvider = playList.songList; // reset the song selection if (selectedSong != null) { songList.selectedItem = selectedSong; } } private function songSelectionChange():void { if (songList.selectedIndex != -1) { setFormState(SONG_DETAIL); } else { setFormState(ADD_SONG); } } private function addNewSong():void { // gather the values from the form and add the new song var title:String = newSongTitle.text; var artist:String = newSongArtist.text; var year:uint = newSongYear.value; var filename:String = newSongFilename.text; var genres:Array = newSongGenres.selectedItems; playList.addSong(new Song(title, artist, year, filename, genres)); refreshList(); // clear out the "add song" form fields setFormState(ADD_SONG); } private function songListLabel(item:Object):String { return item.toString(); } private function setFormState(state:uint):void { // set the form title and control state switch (state) { case ADD_SONG: formTitle.text = "Add New Song"; // show the submit button submitSongData.visible = true; showAddControlsBtn.visible = false; // clear the form fields newSongTitle.text = ""; newSongArtist.text = ""; newSongYear.value = (new Date()).fullYear; newSongFilename.text = ""; newSongGenres.selectedIndex = -1; // deselect the currently selected song (if any) songList.selectedIndex = -1; break; case SONG_DETAIL: formTitle.text = "Song Details"; // populate the form with the selected item's data var selectedSong:Song = Song(songList.selectedItem); newSongTitle.text = selectedSong.title; newSongArtist.text = selectedSong.artist; newSongYear.value = selectedSong.year; newSongFilename.text = selectedSong.filename; newSongGenres.selectedItems = selectedSong.genres; // hide the submit button submitSongData.visible = false; showAddControlsBtn.visible = true; break; } }
Add AS3 example.
Add AS3 example.
ActionScript
bsd-2-clause
tomstuart/pygments,tomstuart/pygments,tomstuart/pygments,tomstuart/pygments,tomstuart/pygments,tomstuart/pygments,tomstuart/pygments,tomstuart/pygments,tomstuart/pygments,tomstuart/pygments,tomstuart/pygments,tomstuart/pygments,tomstuart/pygments,tomstuart/pygments,tomstuart/pygments
842391464f947dfb1de78384de83cdec11ed28cf
src/flash/utils/Endian.as
src/flash/utils/Endian.as
/* * Copyright 2014 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package flash.utils { public final class Endian { public static const BIG_ENDIAN: String = "bigEndian"; public static const LITTLE_ENDIAN: String = "littleEndian"; } }
Add missing builtin flash.utils.Endian
Add missing builtin flash.utils.Endian
ActionScript
apache-2.0
tschneidereit/shumway,yurydelendik/shumway,mozilla/shumway,mbebenita/shumway,mozilla/shumway,mbebenita/shumway,yurydelendik/shumway,mozilla/shumway,mozilla/shumway,tschneidereit/shumway,yurydelendik/shumway,mbebenita/shumway,yurydelendik/shumway,tschneidereit/shumway,mbebenita/shumway,mbebenita/shumway,mbebenita/shumway,mozilla/shumway,yurydelendik/shumway,mbebenita/shumway,yurydelendik/shumway,tschneidereit/shumway,tschneidereit/shumway,mozilla/shumway,tschneidereit/shumway,tschneidereit/shumway,tschneidereit/shumway,mbebenita/shumway,mozilla/shumway,yurydelendik/shumway,mozilla/shumway,yurydelendik/shumway
40df1f5dc2d021e9562c0d4a9e594b4ac00c29c4
src/aerys/minko/render/effect/vertex/VertexUVShader.as
src/aerys/minko/render/effect/vertex/VertexUVShader.as
package aerys.minko.render.effect.vertex { import aerys.minko.render.RenderTarget; import aerys.minko.render.effect.basic.BasicShader; import aerys.minko.render.shader.SFloat; import aerys.minko.type.stream.format.VertexComponent; public class VertexUVShader extends BasicShader { public function VertexUVShader(target : RenderTarget = null, priority : Number = 0) { super(target, priority); } override protected function getPixelColor() : SFloat { var uv : SFloat = getVertexAttribute(VertexComponent.UV); var interpolatedUv : SFloat = normalize(interpolate(uv)); return float4(interpolatedUv.x, interpolatedUv.y, 0, 1); } } }
Add VertexUvShader (vertex streams must have an uv component)
Add VertexUvShader (vertex streams must have an uv component)
ActionScript
mit
aerys/minko-as3
7ae87187fc5daef7a420c6e851e05f684721d937
src/battlecode/world/signals/PartsChangeSignal.as
src/battlecode/world/signals/PartsChangeSignal.as
package battlecode.world.signals { import battlecode.common.MapLocation; public class PartsChangeSignal implements Signal { private var loc:MapLocation; private var parts:Number; public function PartsChangeSignal(loc:MapLocation, parts:Number) { this.loc = loc; this.parts = parts; } public function getLocation():MapLocation { return loc; } public function getParts():Number { return parts; } public function accept(handler:SignalHandler):* { handler.visitPartsChangeSignal(this); } } }
add PartChangeSignal
add PartChangeSignal
ActionScript
mit
trun/battlecode-webclient
2480c3fa86f7c196164d5c9e561e162d0ad7c1eb
onara.as
onara.as
var orz: int; orz=3;
Add onara.as
Add onara.as
ActionScript
mit
hakatashi/onara,hakatashi/onara,hakatashi/onara,hakatashi/onara,hakatashi/onara,hakatashi/onara,hakatashi/onara,hakatashi/onara,hakatashi/onara,hakatashi/onara,hakatashi/onara,hakatashi/onara
4dbbb1c221b82abf40938468b014e68ba25c95bc
dolly-framework/src/test/resources/dolly/data/NotCopyableSubclass.as
dolly-framework/src/test/resources/dolly/data/NotCopyableSubclass.as
package dolly.data { public class NotCopyableSubclass extends CopyableClass { public static var staticProperty2:String = "Value of second-level static property."; private var _writableField2:String = "Value of second-level writable field."; public var property2:String = "Value of second-level public property."; public function NotCopyableSubclass() { super(); } public function get writableField2():String { return _writableField2; } public function set writableField2(value:String):void { _writableField2 = value; } public function get readOnlyField2():String { return "Value of second-level read-only field."; } } }
Create new data class for testing: NotCopyableSubclass.
Create new data class for testing: NotCopyableSubclass.
ActionScript
mit
Yarovoy/dolly
bf97af14196066c3c1d1a046a733379e66b20560
src/avm2/tests/regress/correctness/sort.as
src/avm2/tests/regress/correctness/sort.as
package { function sortFunction(a, b) { return b - a; } (function sort0() { var array = [4, 1, 2, 6, 1, 5]; array.sort(); trace("First Sort: " + array); array.sort(sortFunction); trace("Second Sort: " + array); })(); }
Add sort test case.
Add sort test case.
ActionScript
apache-2.0
mozilla/shumway,tschneidereit/shumway,mbebenita/shumway,yurydelendik/shumway,mbebenita/shumway,mbebenita/shumway,tschneidereit/shumway,yurydelendik/shumway,tschneidereit/shumway,tschneidereit/shumway,tschneidereit/shumway,tschneidereit/shumway,mbebenita/shumway,mozilla/shumway,mozilla/shumway,mozilla/shumway,mbebenita/shumway,mozilla/shumway,mozilla/shumway,yurydelendik/shumway,mbebenita/shumway,yurydelendik/shumway,yurydelendik/shumway,tschneidereit/shumway,mozilla/shumway,yurydelendik/shumway,yurydelendik/shumway,mbebenita/shumway,yurydelendik/shumway,mbebenita/shumway,mozilla/shumway,tschneidereit/shumway
bd0d74a08ea5e7c0e2032e4f201d301b33c1985c
examples/web/app/classes/server/FMSBridge.as
examples/web/app/classes/server/FMSBridge.as
package server { import flash.events.EventDispatcher; import flash.events.NetStatusEvent; import flash.events.Event; import flash.net.Responder; public class FMSBridge extends EventDispatcher { public var connection:FMSConnection; public var client:FMSClient; public function FMSBridge(rtmpAddress:String = null, ...rest) { connection = new FMSConnection(); connection.client = client = new FMSClient(); rtmpAddress && connect.apply(this, [rtmpAddress].concat(rest)); } public function connect(rtmpAddress:String, ...rest):void { connection.connect.apply(this, [rtmpAddress].concat(rest)); } public function dispose():void { connection.dispose(); } public function close():void { connection.close(); } public function registerUser(token:String, email:String, player:String):void { connection.call('registerUser', null, token, email, player); } public function signinUser(token:String):void { connection.call('signinUser', null, token); } public function changePlayer(player:uint):void { connection.call('changePlayer', null, player); } public function startGame():void { connection.call('startGame', null); } } }
Create FMSBridge.as
Create FMSBridge.as
ActionScript
apache-2.0
adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler,adriancmiranda/flash-compiler
a31f5cb460c3d216d28a5b0814a738341ffbb6bd
src/aerys/minko/scene/node/mesh/KeyframedMesh.as
src/aerys/minko/scene/node/mesh/KeyframedMesh.as
package aerys.minko.scene.node.mesh { import aerys.minko.render.effect.Style; import aerys.minko.scene.action.IAction; import aerys.minko.scene.action.mesh.MeshAction; import aerys.minko.scene.node.AbstractScene; import aerys.minko.scene.node.IStyledScene; import aerys.minko.type.stream.IVertexStream; import aerys.minko.type.stream.IndexStream; import aerys.minko.type.stream.VertexStream; import flash.utils.getTimer; public class KeyframedMesh extends AbstractScene implements IMesh, IStyledScene { private var _style : Style; private var _startTime : uint; private var _isPlaying : Boolean; private var _playHeadTime : uint; private var _times : Vector.<uint>; private var _duration : uint; private var _indexStream : IndexStream; private var _vertexStreams : Vector.<VertexStream>; public function get style() : Style { return _style; } public function get styleEnabled() : Boolean { return true; } public function get version() : uint { return 0; } public function get indexStream() : IndexStream { return _indexStream; } public function get vertexStreams() : Vector.<VertexStream> { return _vertexStreams; } public function get vertexStream() : IVertexStream { var playHeadTime : uint = (_isPlaying ? getTimer() - _startTime : _playHeadTime) % _duration; var timeCount : uint = _times.length; for (var timeId : uint = 0; timeId < timeCount; ++timeId) if (_times[timeId] >= playHeadTime) break; if (timeId == 0) return _vertexStreams[0]; else if (timeId == timeCount) return _vertexStreams[timeCount - 1]; else { // var lastTime : uint = _times[timeId - 1]; // var nextTime : uint = _times[timeId]; // var ratio : uint = (playHeadTime - lastTime) / (nextTime - lastTime); return _vertexStreams[timeId - 1]; } } public function get playHeadTime():uint { return _playHeadTime; } public function set playHeadTime(value:uint):void { _playHeadTime = value; } public function KeyframedMesh(vertexStreams : Vector.<VertexStream>, times : Vector.<uint>, duration : uint, indexStream : IndexStream = null) { super(); _isPlaying = false; _indexStream = indexStream; _vertexStreams = vertexStreams; _times = times; _duration = duration; // a keyframed mesh is rendered using a the common mesh action. // only the shader needs to change actions[0] = MeshAction.meshAction; if (!_indexStream) _indexStream = new IndexStream(null, vertexStream.length, vertexStream.dynamic); } public function start() : void { _startTime = getTimer(); _isPlaying = true; } public function stop() : void { _isPlaying = false; } } }
Add a KeyframedMesh class, to handle keyframed animations
Add a KeyframedMesh class, to handle keyframed animations
ActionScript
mit
aerys/minko-as3
995f7e14a0fe5d5036fad6962aac391ba785fcb8
src/main/actionscript/com/dotfold/dotvimstat/tokenreplacement/replacetokens.as
src/main/actionscript/com/dotfold/dotvimstat/tokenreplacement/replacetokens.as
package com.dotfold.dotvimstat.tokenreplacement { /** * Package level function - replace tokens utility. * * Finds named tokens in the template String, with the format: * {name} and replaces them with values found in the supplied Object. * * @author jamesmcnamee * */ public function replacetokens(template:String, data:Object):String { var pattern:RegExp = new RegExp('{([^}]+)}', 'gi'); return template.replace(pattern, function(...rest):String { //match:String, $1:Object):String { var match:String = rest[0] as String; var token:String = rest[1] as String; // find the token vlaue in the object if (data && data.hasOwnProperty(token)) { return data[token]; } // could not replace token, return token as is return match; }); } }
refactor replacetokens to PLF
[feat] refactor replacetokens to PLF - so other classes can use it
ActionScript
mit
dotfold/dotvimstat
d6fc5466b84f6f3caaf296efba4e4898babb0287
dolly-framework/src/test/resources/dolly/data/ClassLevelCloneableSubclass.as
dolly-framework/src/test/resources/dolly/data/ClassLevelCloneableSubclass.as
package dolly.data { [Cloneable] public class ClassLevelCloneableSubclass extends ClassLevelCloneable { private var _writableField2:String; public var property4:String; public var property5:String; public function ClassLevelCloneableSubclass() { super(); } public function get writableField2():String { return _writableField2; } public function set writableField2(value:String):void { _writableField2 = value; } } }
Create data class for testing: ClassLevelCloneableSubclass.
Create data class for testing: ClassLevelCloneableSubclass.
ActionScript
mit
Yarovoy/dolly
464cb0a46820a68b35768b1e87f0f8bf8d0b0814
dolly-framework/src/test/actionscript/dolly/CopyingOfCopyableSubclassTest.as
dolly-framework/src/test/actionscript/dolly/CopyingOfCopyableSubclassTest.as
package dolly { import dolly.core.dolly_internal; import dolly.data.CopyableSubclass; import org.as3commons.reflect.Field; import org.as3commons.reflect.Type; import org.flexunit.asserts.assertEquals; import org.flexunit.asserts.assertNotNull; use namespace dolly_internal; public class CopyingOfCopyableSubclassTest { private var copyableSubclass:CopyableSubclass; private var copyableSubclassType:Type; [Before] public function before():void { copyableSubclass = new CopyableSubclass(); copyableSubclass.property1 = "property1 value"; copyableSubclass.property2 = "property2 value"; copyableSubclass.writableField1 = "writableField1 value"; copyableSubclass.writableField2 = "writableField2 value 7"; copyableSubclassType = Type.forInstance(copyableSubclass); } [After] public function after():void { copyableSubclass = null; copyableSubclassType = null; } [Test] public function findingAllCopyableFieldsForType():void { const copyableFields:Vector.<Field> = Copier.findCopyableFieldsForType(copyableSubclassType); assertNotNull(copyableFields); assertEquals(4, copyableFields.length); assertNotNull(copyableFields[0]); assertNotNull(copyableFields[1]); assertNotNull(copyableFields[2]); assertNotNull(copyableFields[3]); } [Test] public function copyingByCopier():void { const copyInstance:CopyableSubclass = Copier.copy(copyableSubclass); assertNotNull(copyInstance); assertNotNull(copyInstance.property1); assertEquals(copyInstance.property1, copyableSubclass.property1); assertNotNull(copyInstance.writableField1); assertEquals(copyInstance.writableField1, copyableSubclass.writableField1); assertNotNull(copyInstance.writableField2); assertEquals(copyInstance.writableField2, copyableSubclass.writableField2); } [Test] public function copyingByCopyFunction():void { const copyInstance:CopyableSubclass = copy(copyableSubclass); assertNotNull(copyInstance); assertNotNull(copyInstance.property1); assertEquals(copyInstance.property1, copyableSubclass.property1); assertNotNull(copyInstance.writableField1); assertEquals(copyInstance.writableField1, copyableSubclass.writableField1); assertNotNull(copyInstance.writableField2); assertEquals(copyInstance.writableField2, copyableSubclass.writableField2); } } }
Create new test class CopyingOfCopyableSubclassTest for testing of creation copies for CopyableSubclass.
Create new test class CopyingOfCopyableSubclassTest for testing of creation copies for CopyableSubclass.
ActionScript
mit
Yarovoy/dolly
210c6fd31dd393c8e046a49692cb440c54c0ba9a
frameworks/projects/mobiletheme/src/spark/skins/android4/supportClasses/TextSkinBase.as
frameworks/projects/mobiletheme/src/spark/skins/android4/supportClasses/TextSkinBase.as
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package spark.skins.android4.supportClasses { import flash.display.DisplayObject; import mx.core.mx_internal; import spark.components.supportClasses.StyleableTextField; import spark.skins.mobile.supportClasses.MobileSkin; use namespace mx_internal; /** * ActionScript-based skin for text input controls in mobile applications that * uses a StyleableTextField class for the text display. * * @see spark.components.supportClasses.StyleableTextField * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 2.5 * @productversion Flex 4.5 */ public class TextSkinBase extends MobileSkin { //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 2.5 * @productversion Flex 4.5 * */ public function TextSkinBase() { super(); } //-------------------------------------------------------------------------- // // Graphics variables // //-------------------------------------------------------------------------- /** * Defines the border. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 2.5 * @productversion Flex 4.5 */ //-------------------------------------------------------------------------- // // Layout variables // //-------------------------------------------------------------------------- /** * Defines the corner radius. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 2.5 * @productversion Flex 4.5 */ protected var layoutBorderSize:uint; //-------------------------------------------------------------------------- // // Variables // //-------------------------------------------------------------------------- /** * @private * * Instance of the border graphics. */ protected var border:DisplayObject; private var borderVisibleChanged:Boolean = false; //-------------------------------------------------------------------------- // // Skin parts // //-------------------------------------------------------------------------- /** * textDisplay skin part. */ public var textDisplay:StyleableTextField; [Bindable] /** * Bindable promptDisplay skin part. Bindings fire when promptDisplay is * removed and added for proper updating by the SkinnableTextBase. */ public var promptDisplay:StyleableTextField; //-------------------------------------------------------------------------- // // Overridden methods // //-------------------------------------------------------------------------- /** * @private */ override protected function createChildren():void { super.createChildren(); if (!textDisplay) { textDisplay = StyleableTextField(createInFontContext(StyleableTextField)); textDisplay.styleName = this; textDisplay.editable = true; textDisplay.useTightTextBounds = false; addChild(textDisplay); } } /** * @private */ protected function createPromptDisplay():StyleableTextField { var prompt:StyleableTextField = StyleableTextField(createInFontContext(StyleableTextField)); prompt.styleName = this; prompt.editable = false; prompt.mouseEnabled = false; prompt.useTightTextBounds = false; prompt.focusEnabled = false; return prompt; } /** * @private */ override public function styleChanged(styleProp:String):void { var allStyles:Boolean = !styleProp || styleProp == "styleName"; if (allStyles || styleProp == "borderVisible") { borderVisibleChanged = true; invalidateProperties(); } if (allStyles || styleProp.indexOf("padding") == 0) { invalidateDisplayList(); } super.styleChanged(styleProp); } /** * @private */ override protected function commitCurrentState():void { super.commitCurrentState(); alpha = currentState.indexOf("disabled") == -1 ? 1 : 0.5; var showPrompt:Boolean = currentState.indexOf("WithPrompt") >= 0; if (showPrompt && !promptDisplay) { promptDisplay = createPromptDisplay(); addChild(promptDisplay); } else if (!showPrompt && promptDisplay) { removeChild(promptDisplay); promptDisplay = null; } invalidateDisplayList(); } } }
Add android4 specific TextSkinBase
Add android4 specific TextSkinBase
ActionScript
apache-2.0
shyamalschandra/flex-sdk,adufilie/flex-sdk,apache/flex-sdk,SlavaRa/flex-sdk,adufilie/flex-sdk,adufilie/flex-sdk,SlavaRa/flex-sdk,danteinforno/flex-sdk,adufilie/flex-sdk,danteinforno/flex-sdk,apache/flex-sdk,danteinforno/flex-sdk,shyamalschandra/flex-sdk,danteinforno/flex-sdk,shyamalschandra/flex-sdk,SlavaRa/flex-sdk,SlavaRa/flex-sdk,apache/flex-sdk,shyamalschandra/flex-sdk,apache/flex-sdk,shyamalschandra/flex-sdk,SlavaRa/flex-sdk,danteinforno/flex-sdk,apache/flex-sdk,shyamalschandra/flex-sdk,adufilie/flex-sdk,SlavaRa/flex-sdk,danteinforno/flex-sdk,apache/flex-sdk,adufilie/flex-sdk
b3c9c9fb23bbdec6aeca395bd07deb1e06c910f8
frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/IDataProviderItemRendererMapper.as
frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/IDataProviderItemRendererMapper.as
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.html.staticControls.beads { import org.apache.flex.core.IBead; import org.apache.flex.core.IItemRendererClassFactory; /** * Classes that generate ItemRenderers based on dataProvider contents. * These classes use an IItemRendererFactory to generate the actual * ItemRenderer instances */ public interface IDataProviderItemRendererMapper extends IBead { function get itemRendererFactory():IItemRendererClassFactory; function set itemRendererFactory(value:IItemRendererClassFactory):void; } }
add other DataGrid classes from examples/DataGridXCompile for cross-compilation
add other DataGrid classes from examples/DataGridXCompile for cross-compilation
ActionScript
apache-2.0
greg-dove/flex-asjs,greg-dove/flex-asjs,greg-dove/flex-asjs,greg-dove/flex-asjs
7d076cb1674217d0b171d19ce9839e93512dc9d9
dolly-framework/src/test/actionscript/dolly/utils/PropertyUtilTests.as
dolly-framework/src/test/actionscript/dolly/utils/PropertyUtilTests.as
package dolly.utils { import dolly.core.dolly_internal; import mx.collections.ArrayCollection; import mx.collections.ArrayList; use namespace dolly_internal; public class PropertyUtilTests { private var sourceObj:Object; private var targetObj:Object; [Before] public function before():void { sourceObj = {}; sourceObj.array = [0, 1, 2, 3, 4]; sourceObj.arrayList = new ArrayList([0, 1, 2, 3, 4]); sourceObj.arrayCollection = new ArrayCollection([0, 1, 2, 3, 4]); targetObj = {}; } [After] public function after():void { sourceObj = targetObj = null; } } }
Add empty test for PropertyUtil class.
Add empty test for PropertyUtil class.
ActionScript
mit
Yarovoy/dolly
5ae18111ca9fc49a2b2b316beac05a4515009849
dolly-framework/src/test/resources/dolly/data/CompositeCloneableClass.as
dolly-framework/src/test/resources/dolly/data/CompositeCloneableClass.as
package dolly.data { import mx.collections.ArrayCollection; import mx.collections.ArrayList; [Cloneable] public class CompositeCloneableClass { public var cloneable:CloneableClass = new CloneableClass(); public var array:Array = [0, 1, 2, 3, 4]; public var arrayList:ArrayList = new ArrayList([0, 1, 2, 3, 4]); public var arrayCollection:ArrayCollection = new ArrayCollection([0, 1, 2, 3, 4]); public function CompositeCloneableClass() { } } }
Add new test data class: CompositeCloneableClass.
Add new test data class: CompositeCloneableClass.
ActionScript
mit
Yarovoy/dolly
ea898210a2a1c45474f538fbe9a1302831541b10
frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/accessories/CurrencyFormatter.as
frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/accessories/CurrencyFormatter.as
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.html.accessories { import org.apache.flex.core.IBeadModel; import org.apache.flex.core.IFormatBead; import org.apache.flex.core.IStrand; import org.apache.flex.events.Event; import org.apache.flex.events.EventDispatcher; import org.apache.flex.events.IEventDispatcher; /** * The CurrencyFormatter class formats a value in separated groups. The formatter listens * to a property on a model and when the property changes, formats it and dispatches a * formatChanged event. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public class CurrencyFormatter extends EventDispatcher implements IFormatBead { /** * constructor * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function CurrencyFormatter() { super(); } private var _strand:IStrand; /** * @copy org.apache.flex.core.IBead#strand * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function set strand(value:IStrand):void { _strand = value; // Listen for the beadsAdded event which signals when all of a strand's // beads have been added. IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded); } /** * @private */ private function handleBeadsAdded(event:Event):void { // Listen for the change in the model var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel; model.addEventListener(eventName,propertyChangeHandler); model.addEventListener(propertyName+"Change",propertyChangeHandler); // format the current value of that property propertyChangeHandler(null); } private var _propertyName:String; private var _eventName:String; private var _formattedResult:String; private var _fractionalDigits:Number = 2; private var _currencySymbol:String = "$"; /** * The name of the property on the model to format. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function get propertyName():String { if (_propertyName == null) { return "text"; } return _propertyName; } public function set propertyName(value:String):void { _propertyName = value; } /** * The event dispatched by the model when the property changes. The * default is propertyName+"Changed". * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function get eventName():String { if (_eventName == null) { return _propertyName+"Changed"; } return _eventName; } public function set eventName(value:String):void { _eventName = value; } /** * Number of digits after the decimal separator * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function get fractionalDigits():int { return _fractionalDigits; } public function set fractionalDigits(value:int):void { _fractionalDigits = value; } /** * The currency symbol, such as "$" * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function get currencySymbol():String { return _currencySymbol; } public function set currencySymbol(value:String):void { _currencySymbol = value; } /** * The formatted string. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function get formattedString():String { return _formattedResult; } /** * @private */ private function propertyChangeHandler(event:Event):void { // When the property changes, fetch it from the model and // format it, storing the result in _formattedResult. var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel; var value:Object = model[propertyName]; _formattedResult = format(value); // Dispatch the formatChanged event so any bead that's interested in // the formatted string knows to use it. var newEvent:Event = new Event("formatChanged"); this.dispatchEvent(newEvent); } /** * Computes the formatted string. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ public function format(value:Object):String { if (value == null) return ""; var num:Number = Number(value); var source:String = num.toPrecision(fractionalDigits); return currencySymbol + source; } } }
add CurrencyFormatter
add CurrencyFormatter
ActionScript
apache-2.0
greg-dove/flex-asjs,greg-dove/flex-asjs,greg-dove/flex-asjs,greg-dove/flex-asjs
bdfc9cba913e001d2809a6348a4edf03a228c173
tests/examplefiles/as3_test.as
tests/examplefiles/as3_test.as
import flash.events.MouseEvent; import com.example.programmingas3.playlist.PlayList; import com.example.programmingas3.playlist.Song; import com.example.programmingas3.playlist.SortProperty; // constants for the different "states" of the song form private static const ADD_SONG:uint = 1; private static const SONG_DETAIL:uint = 2; private var playList:PlayList = new PlayList(); private function initApp():void { // set the initial state of the song form, for adding a new song setFormState(ADD_SONG); // prepopulate the list with a few songs playList.addSong(new Song("Nessun Dorma", "Luciano Pavarotti", 1990, "nessundorma.mp3", ["90's", "Opera"])); playList.addSong(new Song("Come Undone", "Duran Duran", 1993, "comeundone.mp3", ["90's", "Pop"])); playList.addSong(new Song("Think of Me", "Sarah Brightman", 1987, "thinkofme.mp3", ["Showtunes"])); playList.addSong(new Song("Unbelievable", "EMF", 1991, "unbelievable.mp3", ["90's", "Pop"])); songList.dataProvider = playList.songList; } private function sortList(sortField:SortProperty):void { // Make all the sort type buttons enabled. // The active one will be grayed-out below sortByTitle.selected = false; sortByArtist.selected = false; sortByYear.selected = false; switch (sortField) { case SortProperty.TITLE: sortByTitle.selected = true; break; case SortProperty.ARTIST: sortByArtist.selected = true; break; case SortProperty.YEAR: sortByYear.selected = true; break; } playList.sortList(sortField); refreshList(); } private function refreshList():void { // remember which song was selected var selectedSong:Song = Song(songList.selectedItem); // re-assign the song list as the dataprovider to get the newly sorted list // and force the List control to refresh itself songList.dataProvider = playList.songList; // reset the song selection if (selectedSong != null) { songList.selectedItem = selectedSong; } } private function songSelectionChange():void { if (songList.selectedIndex != -1) { setFormState(SONG_DETAIL); } else { setFormState(ADD_SONG); } } private function addNewSong():void { // gather the values from the form and add the new song var title:String = newSongTitle.text; var artist:String = newSongArtist.text; var year:uint = newSongYear.value; var filename:String = newSongFilename.text; var genres:Array = newSongGenres.selectedItems; playList.addSong(new Song(title, artist, year, filename, genres)); refreshList(); // clear out the "add song" form fields setFormState(ADD_SONG); } private function songListLabel(item:Object):String { return item.toString(); } private function setFormState(state:uint):void { // set the form title and control state switch (state) { case ADD_SONG: formTitle.text = "Add New Song"; // show the submit button submitSongData.visible = true; showAddControlsBtn.visible = false; // clear the form fields newSongTitle.text = ""; newSongArtist.text = ""; newSongYear.value = (new Date()).fullYear; newSongFilename.text = ""; newSongGenres.selectedIndex = -1; // deselect the currently selected song (if any) songList.selectedIndex = -1; break; case SONG_DETAIL: formTitle.text = "Song Details"; // populate the form with the selected item's data var selectedSong:Song = Song(songList.selectedItem); newSongTitle.text = selectedSong.title; newSongArtist.text = selectedSong.artist; newSongYear.value = selectedSong.year; newSongFilename.text = selectedSong.filename; newSongGenres.selectedItems = selectedSong.genres; // hide the submit button submitSongData.visible = false; showAddControlsBtn.visible = true; break; } }
Add AS3 example.
Add AS3 example.
ActionScript
bsd-2-clause
pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments
0665437afa2de835be3774371c1c5abcb3dce75a
zucchini.lib/test/src/pl/ydp/automation/execution/report/impl/formatters/TestLogReportFormatter.as
zucchini.lib/test/src/pl/ydp/automation/execution/report/impl/formatters/TestLogReportFormatter.as
package pl.ydp.automation.execution.report.impl.formatters { import mockolate.mock; import mockolate.strict; import org.flexunit.assertThat; import org.hamcrest.object.equalTo; import pl.ydp.automation.execution.report.ReportData; public class TestLogReportFormatter { private var logFormatter:LogReportFormatter; private var reportData:ReportData; private var INPUT_REPORT_XML:XML = new XML( <testsuites> <testsuite name="checkCheckbox" errors="0" failures="1" tests="4"> <testcase classname="checkCheckbox" name="check checkbox button 2"> <teststep name="loadLesson" classname="check checkbox button 2" status="passed"/> <teststep name="selectButton" classname="check checkbox button 2" status="failed"/> <failure message="Element not found"/> </testcase> <testcase classname="checkCheckbox" name="check checkbox button"> <teststep name="loadLesson" classname="check checkbox button" status="passed"/> <teststep name="selectButton" classname="check checkbox button" status="passed"/> </testcase> </testsuite> </testsuites> ); private var OUTPUT_REPORT:String = '' + '\n-----REPORT START-----\n\n' + 'SUITE:\n' + '\tFAILED - CASE: check checkbox button 2\n' + '\t\tOK - STEP: loadLesson\n' + '\t\tFAILED (Element not found) - STEP: selectButton\n' + '\tOK - CASE: check checkbox button\n' + '\t\tOK - STEP: loadLesson\n' + '\t\tOK - STEP: selectButton\n\n' + '-----REPORT END-----\n' ; [Before] public function setUp():void { logFormatter = new LogReportFormatter(); reportData = strict( ReportData, null, [ INPUT_REPORT_XML ,'' ] ); mock( reportData ).getter( 'reportXML' ).callsSuper(); } [After] public function tearDown():void { } [Test] public function should_format_reportdata():void { // when var report:String = logFormatter.format( reportData ); // then assertThat( report, equalTo( OUTPUT_REPORT ) ); } [BeforeClass] public static function setUpBeforeClass():void { } [AfterClass] public static function tearDownAfterClass():void { } } }
test for bug YPUB-5271
test for bug YPUB-5271 git-svn-id: 4969af7a11582c80b682e8a73ed7b35a57fe0a9c@138479 3e83ccf1-c6ce-0310-9054-8fdb33cf0640
ActionScript
apache-2.0
young-digital-planet/zucchini
5bdf71aab0120aa55b153b67b4d6ba1be5981103
src/org/flintparticles/common/displayObjects/Ring.as
src/org/flintparticles/common/displayObjects/Ring.as
/* * FLINT PARTICLE SYSTEM * ..................... * * Author: Xor (Adrian Stutz) for Nothing GmbH * Copyright (c) Richard Lord 2008-2010 * http://flintparticles.org * * Licence Agreement * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.flintparticles.common.displayObjects { import flash.display.Shape; /** * The Ring class is a DisplayObject with a circle shape that contains a hole. * The registration point of this diaplay object is in the center of the Ring. */ public class Ring extends Shape { private var _outerRadius:Number; private var _innerRadius:Number; private var _color:uint; /** * The constructor creates a Ring with the specified inner and outer radius. * @param outer Outer radius of the ring * @param inner Inner radius of the ring * @param color Color of the ring * @param bm Blend mode of the ring */ public function Ring( outer:Number = 0.9, inner:Number = 1.1, color:uint = 0xFFFFFF, bm:String = "normal" ) { _outerRadius = outer; _innerRadius = inner; _color = color; draw(); blendMode = bm; } private function draw():void { graphics.clear(); graphics.lineStyle( _outerRadius - _innerRadius, _color ); graphics.drawCircle( 0, 0, (_outerRadius + _innerRadius)/2 ); } public function get outerRadius():Number { return _outerRadius; } public function set outerRadius( value:Number ):void { _outerRadius = value; draw(); } public function get innerRadius():Number { return _innerRadius; } public function set innerRadius( value:Number ):void { _innerRadius = value; draw(); } public function get color():uint { return _color; } public function set color( value:uint ):void { _color = value; draw(); } } }
Add Ring display object: A Dot with a hole.
Add Ring display object: A Dot with a hole.
ActionScript
mit
richardlord/Flint
d9777938772b6e36441aff8da80c5ea7da160b20
src/org/hola/ZErr.as
src/org/hola/ZErr.as
package org.hola { import flash.external.ExternalInterface; public class ZErr { public function ZErr() { super(); } public static function log(msg:String, ...rest:Array):void{ if (!ExternalInterface.available) return; ExternalInterface.call.apply(ExternalInterface, ['console.log', msg].concat(rest)) } } }
Add ZErr.as
Add ZErr.as
ActionScript
mpl-2.0
hola/flashls,hola/flashls
54076c4aafe19f4e07bba47d0ad8425a5f5fdd99
src/sample/Act402.as
src/sample/Act402.as
package sample { import starling.display.Sprite; import starling.events.Event; import starling.display.Shape; public class Act402 extends Sprite { private var _shape:Sprite; public function Act402() { super(); addEventListener(Event.ADDED_TO_STAGE, init); } private function init(event:Event):void { removeEventListener(Event.ADDED_TO_STAGE, init); stage.color = 0x000000; drawCircle(); adjustShape(); } private function drawCircle():void { _shape = new Sprite(); var circle:Shape = new Shape(); circle.graphics.beginFill(0xFF0000); circle.graphics.drawCircle(0,0,50); circle.graphics.endFill(); circle.x = 50; circle.y = 50; _shape.addChild(circle); var rect:Shape = new Shape(); rect.graphics.beginFill(0x00FF00); rect.graphics.drawRect(0,100,100,100); rect.graphics.endFill(); _shape.addChild(rect); var triangle:Shape = new Shape(); triangle.graphics.beginFill(0x0000FF,0.2); triangle.graphics.moveTo(50,0); triangle.graphics.lineTo(0,100); triangle.graphics.lineTo(100,100); triangle.graphics.lineTo(50,0); triangle.graphics.endFill(); triangle.x = 0; triangle.y = 200; _shape.addChild(triangle); } private function adjustShape():void { _shape.x = (stage.stageWidth - _shape.width) / 2; _shape.y = (stage.stageHeight - _shape.height) / 2; addChild(_shape); } } }
add starling example
add starling example
ActionScript
mit
z-ohnami/asWork,z-ohnami/asWork
c649b2aa238fa45fefdc396f7e39bf3309f3f418
tamarin-central/thane/flash/geom/Rectangle.as
tamarin-central/thane/flash/geom/Rectangle.as
// // $Id: $ package flash.geom { public class Rectangle { public var x :Number; public var y :Number; public var width :Number; public var height :Number; public function Rectangle (x :Number = 0, y :Number = 0, width :Number = 0, height :Number = 0) { this.x = x; this.y = y; this.width = Math.max(width, 0); this.height = Math.max(height, 0); } public function get bottom () :Number { return y + height; } public function set bottom (value :Number) :void { // TODO: Verify this is what should happen here height = Math.max(y, value) - y; } public function get bottomRight () :Point { return new Point(right, bottom); } public function set bottomRight (value :Point) :void { bottom = value.y; right = value.x; } public function get left () :Number { return x; } public function set left (value :Number) :void { var r :Number = x + width; x = Math.min(right, value); width = r - x; } public function get right () :Number { return x + width; } public function set right (value :Number) :void { width = Math.max(0, value - x); } public function get size () :Point { return new Point(width, height); } public function set size (value :Point) :void { width = value.x; height = value.y; } public function get top () :Number { return y; } public function set top (value :Number) :void { var b :Number = y + height; y = Math.min(bottom, value); height = b - y; } public function get topLeft () :Point { return new Point(x, y); } public function set topLeft (value :Point) :void { top = value.x; left = value.y; } public function contains (x :Number, y :Number) :Boolean { return x >= left && x <= right && y >= top && y <= bottom; } public function containsPoint (p :Point) :Boolean { return contains(p.x, p.y); } public function containsRect(r :Rectangle) :Boolean { return r.left >= left && r.right <= right && r.top >= top && r.bottom <= bottom; } public function inflate (dX :Number, dY :Number) :void { x -= dX; width += 2*dX; y -= dY; height += 2*dY; } public function inflatePoint (p :Point) :void { inflate(p.x, p.y); } public function intersection (rect :Rectangle) :Rectangle { if (!intersects(rect)) { return new Rectangle(0, 0, 0, 0); } var l :Number = Math.max(left, rect.left); var r :Number = Math.min(right, rect.right); var t :Number = Math.max(top, rect.top); var b :Number = Math.min(bottom, rect.bottom); return new Rectangle(l, t, r-l, b-t); } public function intersects (r :Rectangle) :Boolean { return r.top <= bottom && r.bottom >= top && r.left <= right && r.right >= left; } public function isEmpty () :Boolean { return width <= 0 && height <= 0; } public function offset (dX :Number, dY :Number) :void { x += dX; y += dY; } public function offsetPoint (p :Point) :void { offset(p.x, p.y); } public function setEmpty () :void { x = y = width = height = 0; } public function union (rect :Rectangle) :Rectangle { var l :Number = Math.min(left, rect.left); var r :Number = Math.max(right, rect.right); var t :Number = Math.min(top, rect.top); var b :Number = Math.max(bottom, rect.bottom); return new Rectangle(l, t, r-l, b-t); } public function clone () :Rectangle { return new Rectangle(x, y, width, height); } public function equals (r :Rectangle) :Boolean { return r.x == x && r.y == y && r.width == width && r.height == height; } public function toString () :String { return "(x=" + x + ", y=" + y + ", width=" + width + ", height=" + height + ")"; } } }
Implement flash.geom.Rectangle. Boy, that was mindnumbing. Also I suspect maybe the Flash version allows negative width and height, but I'm not going to think about that just now.
Implement flash.geom.Rectangle. Boy, that was mindnumbing. Also I suspect maybe the Flash version allows negative width and height, but I'm not going to think about that just now.
ActionScript
bsd-2-clause
greyhavens/thane,greyhavens/thane,greyhavens/thane,greyhavens/thane,greyhavens/thane,greyhavens/thane,greyhavens/thane
7e36bc4f56efa957b5a0ea6ac303a4436034afcc
src/avm2/tests/regress/correctness/coerce-1.as
src/avm2/tests/regress/correctness/coerce-1.as
package { class A { function foo(a: Class, b: A) { trace(a); trace(b); } } (new A()).foo(A, new A()); }
Add test case.
Add test case.
ActionScript
apache-2.0
mbebenita/shumway,tschneidereit/shumway,mbebenita/shumway,mbebenita/shumway,tschneidereit/shumway,mozilla/shumway,mozilla/shumway,mbebenita/shumway,yurydelendik/shumway,tschneidereit/shumway,yurydelendik/shumway,mozilla/shumway,mozilla/shumway,yurydelendik/shumway,mozilla/shumway,tschneidereit/shumway,tschneidereit/shumway,mbebenita/shumway,mbebenita/shumway,tschneidereit/shumway,tschneidereit/shumway,yurydelendik/shumway,yurydelendik/shumway,yurydelendik/shumway,mozilla/shumway,tschneidereit/shumway,mozilla/shumway,yurydelendik/shumway,mbebenita/shumway,yurydelendik/shumway,mozilla/shumway,mbebenita/shumway
0c7a95a8d0783cd719ab5c5553bf77c0520607aa
src/as/com/threerings/flash/BackgroundJPGEncoder.as
src/as/com/threerings/flash/BackgroundJPGEncoder.as
// // $Id: ImageUtil.as 189 2007-04-07 00:25:46Z dhoover $ // // Nenya library - tools for developing networked games // Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved // http://www.threerings.net/code/nenya/ // // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or // (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package com.threerings.flash { import flash.display.*; import flash.events.*; import flash.utils.Timer; import com.threerings.util.ValueEvent; /** * Dispatched when the jpeg is complete. * The 'value' property will contain the received data. * * @eventType flash.events.Event.COMPLETE */ [Event(name="complete", type="com.threerings.util.ValueEvent")] /** * Class that will encode a jpeg in the background and fire an event when it's done. */ public class BackgroundJPGEncoder extends EventDispatcher { /** * Construct a jpeg encoder. Once started, the encoder will encode a jpeg over the course * of multiple frames, generating an event to deliver the finished jpeg when it is done. * * @param image The bitmap to encode. * @param quality The jpeg quality from 1 to 100 which determines the compression level. * @param timeSlice The number of milliseconds of processing to do per frame. */ public function BackgroundJPGEncoder ( image :BitmapData, quality :Number = 50, timeSlice :int = 100) { _timeSlice = timeSlice; _encoder = new JPGEncoder(image, quality, PIXEL_GRANULARITY); _timer = new Timer(1); _timer.addEventListener(TimerEvent.TIMER, timerHandler); } /** * Start encoding */ public function start () :void { _timer.start(); } /** * Cancel encoding and discard any intermediate results. */ public function cancel () :void { _timer.stop(); _timer = null; _encoder = null; } protected function timerHandler (event :TimerEvent) :void { if (_encoder.process(_timeSlice)) { _timer.stop(); // The jpeg is ready so we fire an event passing it to the consumer. dispatchEvent(new ValueEvent(Event.COMPLETE, _encoder.getJpeg())); } } protected var _timeSlice :int; protected var _timer :Timer; protected var _encoder :JPGEncoder; protected const PIXEL_GRANULARITY :int = 100; } }
Add a background jpeg encoder which uses the JPGEncoder to spread out encoding over a series of frames.
Add a background jpeg encoder which uses the JPGEncoder to spread out encoding over a series of frames. git-svn-id: b675b909355d5cf946977f44a8ec5a6ceb3782e4@586 ed5b42cb-e716-0410-a449-f6a68f950b19
ActionScript
lgpl-2.1
threerings/nenya,threerings/nenya
7d40c4c905fa5e61ea4edeb1c508f5c1eb92077b
tests/examplefiles/as3_test.as
tests/examplefiles/as3_test.as
import flash.events.MouseEvent; import com.example.programmingas3.playlist.PlayList; import com.example.programmingas3.playlist.Song; import com.example.programmingas3.playlist.SortProperty; // constants for the different "states" of the song form private static const ADD_SONG:uint = 1; private static const SONG_DETAIL:uint = 2; private var playList:PlayList = new PlayList(); private function initApp():void { // set the initial state of the song form, for adding a new song setFormState(ADD_SONG); // prepopulate the list with a few songs playList.addSong(new Song("Nessun Dorma", "Luciano Pavarotti", 1990, "nessundorma.mp3", ["90's", "Opera"])); playList.addSong(new Song("Come Undone", "Duran Duran", 1993, "comeundone.mp3", ["90's", "Pop"])); playList.addSong(new Song("Think of Me", "Sarah Brightman", 1987, "thinkofme.mp3", ["Showtunes"])); playList.addSong(new Song("Unbelievable", "EMF", 1991, "unbelievable.mp3", ["90's", "Pop"])); songList.dataProvider = playList.songList; } private function sortList(sortField:SortProperty):void { // Make all the sort type buttons enabled. // The active one will be grayed-out below sortByTitle.selected = false; sortByArtist.selected = false; sortByYear.selected = false; switch (sortField) { case SortProperty.TITLE: sortByTitle.selected = true; break; case SortProperty.ARTIST: sortByArtist.selected = true; break; case SortProperty.YEAR: sortByYear.selected = true; break; } playList.sortList(sortField); refreshList(); } private function refreshList():void { // remember which song was selected var selectedSong:Song = Song(songList.selectedItem); // re-assign the song list as the dataprovider to get the newly sorted list // and force the List control to refresh itself songList.dataProvider = playList.songList; // reset the song selection if (selectedSong != null) { songList.selectedItem = selectedSong; } } private function songSelectionChange():void { if (songList.selectedIndex != -1) { setFormState(SONG_DETAIL); } else { setFormState(ADD_SONG); } } private function addNewSong():void { // gather the values from the form and add the new song var title:String = newSongTitle.text; var artist:String = newSongArtist.text; var year:uint = newSongYear.value; var filename:String = newSongFilename.text; var genres:Array = newSongGenres.selectedItems; playList.addSong(new Song(title, artist, year, filename, genres)); refreshList(); // clear out the "add song" form fields setFormState(ADD_SONG); } private function songListLabel(item:Object):String { return item.toString(); } private function setFormState(state:uint):void { // set the form title and control state switch (state) { case ADD_SONG: formTitle.text = "Add New Song"; // show the submit button submitSongData.visible = true; showAddControlsBtn.visible = false; // clear the form fields newSongTitle.text = ""; newSongArtist.text = ""; newSongYear.value = (new Date()).fullYear; newSongFilename.text = ""; newSongGenres.selectedIndex = -1; // deselect the currently selected song (if any) songList.selectedIndex = -1; break; case SONG_DETAIL: formTitle.text = "Song Details"; // populate the form with the selected item's data var selectedSong:Song = Song(songList.selectedItem); newSongTitle.text = selectedSong.title; newSongArtist.text = selectedSong.artist; newSongYear.value = selectedSong.year; newSongFilename.text = selectedSong.filename; newSongGenres.selectedItems = selectedSong.genres; // hide the submit button submitSongData.visible = false; showAddControlsBtn.visible = true; break; } }
Add AS3 example.
Add AS3 example.
ActionScript
bsd-2-clause
aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments
3c1b875b8fa2b41f24fa3e5a69e7e57b530702e9
src/org/mangui/hls/event/HLSEvent.as
src/org/mangui/hls/event/HLSEvent.as
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mangui.hls.event { import org.mangui.hls.model.Level; import flash.events.Event; /** Event fired when an error prevents playback. **/ public class HLSEvent extends Event { /** Identifier for a manifest loading event, triggered after a call to hls.load(url) **/ public static const MANIFEST_LOADING : String = "hlsEventManifestLoading"; /** Identifier for a manifest parsed event, * triggered after main manifest has been retrieved and parsed. * hls playlist may not be playable yet, in case of adaptive streaming, start level playlist is not downloaded yet at that stage */ public static const MANIFEST_PARSED : String = "hlsEventManifestParsed"; /** Identifier for a manifest loaded event, when this event is received, main manifest and start level has been retrieved */ public static const MANIFEST_LOADED : String = "hlsEventManifestLoaded"; /** Identifier for a level loading event **/ public static const LEVEL_LOADING : String = "hlsEventLevelLoading"; /** Identifier for a level loaded event **/ public static const LEVEL_LOADED : String = "hlsEventLevelLoaded"; /** Identifier for a level switch event. **/ public static const LEVEL_SWITCH : String = "hlsEventLevelSwitch"; /** Identifier for a level ENDLIST event. **/ public static const LEVEL_ENDLIST : String = "hlsEventLevelEndList"; /** Identifier for a fragment loading event. **/ public static const FRAGMENT_LOADING : String = "hlsEventFragmentLoading"; /** Identifier for a fragment loaded event. **/ public static const FRAGMENT_LOADED : String = "hlsEventFragmentLoaded"; /** Identifier for a fragment playing event. **/ public static const FRAGMENT_PLAYING : String = "hlsEventFragmentPlaying"; /** Identifier for a audio tracks list change **/ public static const AUDIO_TRACKS_LIST_CHANGE : String = "audioTracksListChange"; /** Identifier for a audio track switch **/ public static const AUDIO_TRACK_SWITCH : String = "audioTrackSwitch"; /** Identifier for a audio level loading event **/ public static const AUDIO_LEVEL_LOADING : String = "hlsEventAudioLevelLoading"; /** Identifier for a audio level loaded event **/ public static const AUDIO_LEVEL_LOADED : String = "hlsEventAudioLevelLoaded"; /** Identifier for audio/video TAGS loaded event. **/ public static const TAGS_LOADED : String = "hlsEventTagsLoaded"; /** Identifier when last fragment of playlist has been loaded **/ public static const LAST_VOD_FRAGMENT_LOADED : String = "hlsEventLastFragmentLoaded"; /** Identifier for a playback error event. **/ public static const ERROR : String = "hlsEventError"; /** Identifier for a playback media time change event. **/ public static const MEDIA_TIME : String = "hlsEventMediaTime"; /** Identifier for a playback state switch event. **/ public static const PLAYBACK_STATE : String = "hlsPlaybackState"; /** Identifier for a seek state switch event. **/ public static const SEEK_STATE : String = "hlsSeekState"; /** Identifier for stream type changes: VoD or Live **/ public static const STREAM_TYPE_DID_CHANGE:String = "hlsEventStreamTypeDidChange"; /** Identifier for a playback complete event. **/ public static const PLAYBACK_COMPLETE : String = "hlsEventPlayBackComplete"; /** Identifier for a Playlist Duration updated event **/ public static const PLAYLIST_DURATION_UPDATED : String = "hlsPlayListDurationUpdated"; /** Identifier for a ID3 updated event **/ public static const ID3_UPDATED : String = "hlsID3Updated"; /** Identifier for a fps drop event **/ public static const FPS_DROP : String = "hlsFPSDrop"; /** Identifier for a fps drop level capping event **/ public static const FPS_DROP_LEVEL_CAPPING : String = "hlsFPSDropLevelCapping"; /** Identifier for a fps drop smooth level switch event **/ public static const FPS_DROP_SMOOTH_LEVEL_SWITCH : String = "hlsFPSDropSmoothLevelSwitch"; /** Identifier for a live loading stalled event **/ public static const LIVE_LOADING_STALLED : String = "hlsLiveLoadingStalled"; /** Identifier for a Stage set event **/ public static const STAGE_SET : String = "hlsStageSet"; /** The current url **/ public var url : String; /** The current quality level. **/ public var level : int; /** The current playlist duration. **/ public var duration : Number; /** The list with quality levels. **/ public var levels : Vector.<Level>; /** The error message. **/ public var error : HLSError; /** Load Metrics. **/ public var loadMetrics : HLSLoadMetrics; /** Play Metrics. **/ public var playMetrics : HLSPlayMetrics; /** The time position. **/ public var mediatime : HLSMediatime; /** The new playback state. **/ public var state : String; /** The current audio track **/ public var audioTrack : int; /** a complete ID3 payload from PES, as a hex dump **/ public var ID3Data : String; /** Assign event parameter and dispatch. **/ public function HLSEvent(type : String, parameter : *=null, parameter2 : *=null) { switch(type) { case MANIFEST_LOADING: case FRAGMENT_LOADING: url = parameter as String; break; case ERROR: error = parameter as HLSError; break; case TAGS_LOADED: case FRAGMENT_LOADED: case LEVEL_LOADED: case AUDIO_LEVEL_LOADED: loadMetrics = parameter as HLSLoadMetrics; break; case MANIFEST_PARSED: case MANIFEST_LOADED: levels = parameter as Vector.<Level>; if(parameter2) { loadMetrics = parameter2 as HLSLoadMetrics; } break; case MEDIA_TIME: mediatime = parameter as HLSMediatime; break; case PLAYBACK_STATE: case SEEK_STATE: state = parameter as String; break; case LEVEL_LOADING: case LEVEL_SWITCH: case AUDIO_LEVEL_LOADING: case FPS_DROP: case FPS_DROP_LEVEL_CAPPING: level = parameter as int; break; case PLAYLIST_DURATION_UPDATED: duration = parameter as Number; break; case ID3_UPDATED: ID3Data = parameter as String; break; case FRAGMENT_PLAYING: playMetrics = parameter as HLSPlayMetrics; break; default: break; } super(type, false, false); } } }
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mangui.hls.event { import org.mangui.hls.model.Level; import flash.events.Event; /** Event fired when an error prevents playback. **/ public class HLSEvent extends Event { /** Identifier for a manifest loading event, triggered after a call to hls.load(url) **/ public static const MANIFEST_LOADING : String = "hlsEventManifestLoading"; /** Identifier for a manifest parsed event, * triggered after main manifest has been retrieved and parsed. * hls playlist may not be playable yet, in case of adaptive streaming, start level playlist is not downloaded yet at that stage */ public static const MANIFEST_PARSED : String = "hlsEventManifestParsed"; /** Identifier for a manifest loaded event, when this event is received, main manifest and start level has been retrieved */ public static const MANIFEST_LOADED : String = "hlsEventManifestLoaded"; /** Identifier for a level loading event **/ public static const LEVEL_LOADING : String = "hlsEventLevelLoading"; /** Identifier for a level loaded event **/ public static const LEVEL_LOADED : String = "hlsEventLevelLoaded"; /** Identifier for a level switch event. **/ public static const LEVEL_SWITCH : String = "hlsEventLevelSwitch"; /** Identifier for a level ENDLIST event. **/ public static const LEVEL_ENDLIST : String = "hlsEventLevelEndList"; /** Identifier for a fragment loading event. **/ public static const FRAGMENT_LOADING : String = "hlsEventFragmentLoading"; /** Identifier for a fragment loaded event. **/ public static const FRAGMENT_LOADED : String = "hlsEventFragmentLoaded"; /** Identifier for a fragment playing event. **/ public static const FRAGMENT_PLAYING : String = "hlsEventFragmentPlaying"; /** Identifier for a audio tracks list change **/ public static const AUDIO_TRACKS_LIST_CHANGE : String = "audioTracksListChange"; /** Identifier for a audio track switch **/ public static const AUDIO_TRACK_SWITCH : String = "audioTrackSwitch"; /** Identifier for a audio level loading event **/ public static const AUDIO_LEVEL_LOADING : String = "hlsEventAudioLevelLoading"; /** Identifier for a audio level loaded event **/ public static const AUDIO_LEVEL_LOADED : String = "hlsEventAudioLevelLoaded"; /** Identifier for audio/video TAGS loaded event. **/ public static const TAGS_LOADED : String = "hlsEventTagsLoaded"; /** Identifier when last fragment of playlist has been loaded **/ public static const LAST_VOD_FRAGMENT_LOADED : String = "hlsEventLastFragmentLoaded"; /** Identifier for a playback error event. **/ public static const ERROR : String = "hlsEventError"; /** Identifier for a playback media time change event. **/ public static const MEDIA_TIME : String = "hlsEventMediaTime"; /** Identifier for a playback state switch event. **/ public static const PLAYBACK_STATE : String = "hlsPlaybackState"; /** Identifier for a seek state switch event. **/ public static const SEEK_STATE : String = "hlsSeekState"; /** Identifier for stream type changes: VoD or Live, type will be stored in 'streamType' field **/ public static const STREAM_TYPE_DID_CHANGE:String = "hlsEventStreamTypeDidChange"; /** Identifier for a playback complete event. **/ public static const PLAYBACK_COMPLETE : String = "hlsEventPlayBackComplete"; /** Identifier for a Playlist Duration updated event **/ public static const PLAYLIST_DURATION_UPDATED : String = "hlsPlayListDurationUpdated"; /** Identifier for a ID3 updated event **/ public static const ID3_UPDATED : String = "hlsID3Updated"; /** Identifier for a fps drop event **/ public static const FPS_DROP : String = "hlsFPSDrop"; /** Identifier for a fps drop level capping event **/ public static const FPS_DROP_LEVEL_CAPPING : String = "hlsFPSDropLevelCapping"; /** Identifier for a fps drop smooth level switch event **/ public static const FPS_DROP_SMOOTH_LEVEL_SWITCH : String = "hlsFPSDropSmoothLevelSwitch"; /** Identifier for a live loading stalled event **/ public static const LIVE_LOADING_STALLED : String = "hlsLiveLoadingStalled"; /** Identifier for a Stage set event **/ public static const STAGE_SET : String = "hlsStageSet"; /** The current url **/ public var url : String; /** The current quality level. **/ public var level : int; /** The current playlist duration. **/ public var duration : Number; /** The list with quality levels. **/ public var levels : Vector.<Level>; /** The error message. **/ public var error : HLSError; /** Load Metrics. **/ public var loadMetrics : HLSLoadMetrics; /** Play Metrics. **/ public var playMetrics : HLSPlayMetrics; /** The time position. **/ public var mediatime : HLSMediatime; /** The new playback state. **/ public var state : String; /** The new stream type value **/ public var streamType: String; /** The current audio track **/ public var audioTrack : int; /** a complete ID3 payload from PES, as a hex dump **/ public var ID3Data : String; /** Assign event parameter and dispatch. **/ public function HLSEvent(type : String, parameter : *=null, parameter2 : *=null) { switch(type) { case MANIFEST_LOADING: case FRAGMENT_LOADING: url = parameter as String; break; case ERROR: error = parameter as HLSError; break; case TAGS_LOADED: case FRAGMENT_LOADED: case LEVEL_LOADED: case AUDIO_LEVEL_LOADED: loadMetrics = parameter as HLSLoadMetrics; break; case MANIFEST_PARSED: case MANIFEST_LOADED: levels = parameter as Vector.<Level>; if(parameter2) { loadMetrics = parameter2 as HLSLoadMetrics; } break; case MEDIA_TIME: mediatime = parameter as HLSMediatime; break; case PLAYBACK_STATE: case SEEK_STATE: state = parameter as String; break; case LEVEL_LOADING: case LEVEL_SWITCH: case AUDIO_LEVEL_LOADING: case FPS_DROP: case FPS_DROP_LEVEL_CAPPING: level = parameter as int; break; case PLAYLIST_DURATION_UPDATED: duration = parameter as Number; break; case ID3_UPDATED: ID3Data = parameter as String; break; case FRAGMENT_PLAYING: playMetrics = parameter as HLSPlayMetrics; break; case HLSEvent.STREAM_TYPE_DID_CHANGE: // Stream Type is required streamType = String(parameter); break; default: break; } super(type, false, false); } } }
store type in event object
store type in event object
ActionScript
mpl-2.0
clappr/flashls,hola/flashls,NicolasSiver/flashls,neilrackett/flashls,fixedmachine/flashls,tedconf/flashls,fixedmachine/flashls,codex-corp/flashls,neilrackett/flashls,jlacivita/flashls,hola/flashls,vidible/vdb-flashls,NicolasSiver/flashls,loungelogic/flashls,tedconf/flashls,vidible/vdb-flashls,mangui/flashls,loungelogic/flashls,codex-corp/flashls,clappr/flashls,mangui/flashls,jlacivita/flashls
b9c40f0b9d331c47b2c38e5d96c074eade7f196c
generator/sources/as3/delegates/media/MediaUpdateThumbnailJpegDelegate.as
generator/sources/as3/delegates/media/MediaUpdateThumbnailJpegDelegate.as
package com.kaltura.delegates.media { import com.kaltura.config.KalturaConfig; import com.kaltura.core.KClassFactory; import com.kaltura.delegates.WebDelegateBase; import com.kaltura.errors.KalturaError; import com.kaltura.net.KalturaCall; import com.kaltura.net.KalturaFileCall; import flash.events.Event; import flash.net.URLLoaderDataFormat; import flash.utils.getDefinitionByName; import mx.utils.UIDUtil; import ru.inspirit.net.MultipartURLLoader; public class MediaUpdateThumbnailJpegDelegate extends WebDelegateBase { protected var mrloader:MultipartURLLoader; public function MediaUpdateThumbnailJpegDelegate(call:KalturaCall, config:KalturaConfig) { super(call, config); } override public function parse( result : XML ) : * { var cls : Class = getDefinitionByName('com.kaltura.vo.'+ result.result.objectType) as Class; var obj : * = (new KClassFactory( cls )).newInstanceFromXML( result.result ); return obj; } override protected function sendRequest():void { //construct the loader createURLLoader(); //create the service request for normal calls var variables:String = decodeURIComponent(call.args.toString()); var req:String = _config.domain +"/"+_config.srvUrl+"?service="+call.service+"&action="+call.action +'&'+variables; mrloader.addFile((call as KalturaFileCall).bytes, UIDUtil.createUID(), 'fileData'); mrloader.dataFormat = URLLoaderDataFormat.TEXT; mrloader.load(req); } // Event Handlers override protected function onDataComplete(event:Event):void { try{ handleResult( XML(event.target.loader.data) ); } catch( e:Error ) { var kErr : KalturaError = new KalturaError(); kErr.errorCode = String(e.errorID); kErr.errorMsg = e.message; _call.handleError( kErr ); } } override protected function createURLLoader():void { mrloader = new MultipartURLLoader(); mrloader.addEventListener(Event.COMPLETE, onDataComplete); } } }
package com.kaltura.delegates.media { import com.kaltura.config.KalturaConfig; import com.kaltura.core.KClassFactory; import com.kaltura.delegates.WebDelegateBase; import com.kaltura.errors.KalturaError; import com.kaltura.net.KalturaCall; import com.kaltura.net.KalturaFileCall; import flash.events.Event; import flash.net.URLLoaderDataFormat; import flash.utils.getDefinitionByName; import mx.utils.UIDUtil; import ru.inspirit.net.MultipartURLLoader; public class MediaUpdateThumbnailJpegDelegate extends WebDelegateBase { protected var mrloader:MultipartURLLoader; public function MediaUpdateThumbnailJpegDelegate(call:KalturaCall, config:KalturaConfig) { super(call, config); } override public function parse( result : XML ) : * { var cls : Class = getDefinitionByName('com.kaltura.vo.'+ result.result.objectType) as Class; var obj : * = (new KClassFactory( cls )).newInstanceFromXML( result.result ); return obj; } override protected function sendRequest():void { //construct the loader createURLLoader(); //create the service request for normal calls var variables:String = decodeURIComponent(call.args.toString()); var req:String = _config.protocol + _config.domain +"/"+_config.srvUrl+"?service="+call.service+"&action="+call.action +'&'+variables; mrloader.addFile((call as KalturaFileCall).bytes, UIDUtil.createUID(), 'fileData'); mrloader.dataFormat = URLLoaderDataFormat.TEXT; mrloader.load(req); } // Event Handlers override protected function onDataComplete(event:Event):void { try{ handleResult( XML(event.target.loader.data) ); } catch( e:Error ) { var kErr : KalturaError = new KalturaError(); kErr.errorCode = String(e.errorID); kErr.errorMsg = e.message; _call.handleError( kErr ); } } override protected function createURLLoader():void { mrloader = new MultipartURLLoader(); mrloader.addEventListener(Event.COMPLETE, onDataComplete); } } }
use client protocol definition
use client protocol definition git-svn-id: 8a2ccb88241e16c78017770bc38d91d6d5396a5a@51541 6b8eccd3-e8c5-4e7d-8186-e12b5326b719
ActionScript
agpl-3.0
gale320/server,matsuu/server,DBezemer/server,ratliff/server,DBezemer/server,gale320/server,doubleshot/server,gale320/server,doubleshot/server,ivesbai/server,doubleshot/server,doubleshot/server,doubleshot/server,jorgevbo/server,kaltura/server,matsuu/server,ivesbai/server,ivesbai/server,doubleshot/server,gale320/server,ivesbai/server,kaltura/server,DBezemer/server,jorgevbo/server,ratliff/server,ratliff/server,ivesbai/server,kaltura/server,gale320/server,ratliff/server,kaltura/server,ratliff/server,gale320/server,matsuu/server,DBezemer/server,DBezemer/server,kaltura/server,jorgevbo/server,jorgevbo/server,DBezemer/server,kaltura/server,ratliff/server,doubleshot/server,ivesbai/server,jorgevbo/server,matsuu/server,ivesbai/server,jorgevbo/server,matsuu/server,ivesbai/server,gale320/server,doubleshot/server,DBezemer/server,ratliff/server,matsuu/server,ratliff/server,jorgevbo/server,gale320/server,matsuu/server,DBezemer/server,jorgevbo/server,matsuu/server
7480aa54aa6f956ed89e8225ab16df5f50d96524
src/org/mangui/hls/HLSSettings.as
src/org/mangui/hls/HLSSettings.as
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mangui.hls { import org.mangui.hls.constant.HLSSeekMode; import org.mangui.hls.constant.HLSMaxLevelCappingMode; public final class HLSSettings extends Object { /** * autoStartLoad * * if set to true, * start level playlist and first fragments will be loaded automatically, * after triggering of HlsEvent.MANIFEST_PARSED event * if set to false, * an explicit API call (hls.startLoad()) will be needed * to start quality level/fragment loading. * * Default is true */ public static var autoStartLoad : Boolean = true; /** * capLevelToStage * * Limit levels usable in auto-quality by the stage dimensions (width and height). * true - level width and height (defined in m3u8 playlist) will be compared with the player width and height (stage.stageWidth and stage.stageHeight). * Max level will be set depending on the maxLevelCappingMode option. * false - levels will not be limited. All available levels could be used in auto-quality mode taking only bandwidth into consideration. * * Note: this setting is ignored in manual mode so all the levels could be selected manually. * * Default is false */ public static var capLevelToStage : Boolean = false; /** * maxLevelCappingMode * * Defines the max level capping mode to the one available in HLSMaxLevelCappingMode * HLSMaxLevelCappingMode.DOWNSCALE - max capped level should be the one with the dimensions equal or greater than the stage dimensions (so the video will be downscaled) * HLSMaxLevelCappingMode.UPSCALE - max capped level should be the one with the dimensions equal or lower than the stage dimensions (so the video will be upscaled) * * Default is HLSMaxLevelCappingMode.DOWNSCALE */ public static var maxLevelCappingMode : String = HLSMaxLevelCappingMode.DOWNSCALE; // // // // // // ///////////////////////////////// // // org.mangui.hls.stream.HLSNetStream // // // // // // // ///////////////////////////////// /** * minBufferLength * * Defines minimum buffer length in seconds before playback can start, after seeking or buffer stalling. * * Default is -1 = auto */ public static var minBufferLength : Number = -1; /** * minBufferLengthCapping * * Defines minimum buffer length capping value (max value) if minBufferLength is set to -1 * * Default is -1 = no capping */ public static var minBufferLengthCapping : Number = -1; /** * maxBufferLength * * Defines maximum buffer length in seconds. * (0 means infinite buffering) * * Default is 120 */ public static var maxBufferLength : Number = 120; /** * maxBackBufferLength * * Defines maximum back buffer length in seconds. * (0 means infinite back buffering) * * Default is 30 */ public static var maxBackBufferLength : Number = 30; /** * lowBufferLength * * Defines low buffer length in seconds. * When crossing down this threshold, HLS will switch to buffering state. * * Default is 3 */ public static var lowBufferLength : Number = 3; /** * mediaTimeUpdatePeriod * * time update period in ms * period at which HLSEvent.MEDIA_TIME will be triggered * Default is 100 ms */ public static var mediaTimePeriod : int = 100; /** * fpsDroppedMonitoringPeriod * * dropped FPS Monitor Period in ms * period at which nb dropped FPS will be checked * Default is 5000 ms */ public static var fpsDroppedMonitoringPeriod : int = 5000; /** * fpsDroppedMonitoringThreshold * * dropped FPS Threshold * every fpsDroppedMonitoringPeriod, dropped FPS will be compared to displayed FPS. * if during that period, ratio of (dropped FPS/displayed FPS) is greater or equal * than fpsDroppedMonitoringThreshold, HLSEvent.FPS_DROP event will be fired * Default is 0.2 (20%) */ public static var fpsDroppedMonitoringThreshold : Number = 0.2; /** * capLevelonFPSDrop * * Limit levels usable in auto-quality when FPS drop is detected * i.e. if frame drop is detected on level 5, auto level will be capped to level 4 a * true - enabled * false - disabled * * Note: this setting is ignored in manual mode so all the levels could be selected manually. * * Default is true */ public static var capLevelonFPSDrop : Boolean = true; /** * smoothAutoSwitchonFPSDrop * * force a smooth level switch Limit when FPS drop is detected in auto-quality * i.e. if frame drop is detected on level 5, it will trigger an auto quality level switch * to level 4 for next fragment * true - enabled * false - disabled * * Note: this setting is active only if capLevelonFPSDrop==true * * Default is true */ public static var smoothAutoSwitchonFPSDrop : Boolean = true; /** * seekMode * * Defines seek mode to one form available in HLSSeekMode class: * HLSSeekMode.ACCURATE_SEEK - accurate seeking to exact requested position * HLSSeekMode.KEYFRAME_SEEK - key-frame based seeking (seek to nearest key frame before requested seek position) * * Default is HLSSeekMode.KEYFRAME_SEEK */ public static var seekMode : String = HLSSeekMode.KEYFRAME_SEEK; /** * keyLoadMaxRetry * * Max nb of retries for Key Loading in case I/O errors are met, * 0, means no retry, error will be triggered automatically * -1 means infinite retry * * Default is 3 */ public static var keyLoadMaxRetry : int = 3; /** * keyLoadMaxRetryTimeout * * Maximum key retry timeout (in milliseconds) in case I/O errors are met. * Every fail on key request, player will exponentially increase the timeout to try again. * It starts waiting 1 second (1000ms), than 2, 4, 8, 16, until keyLoadMaxRetryTimeout is reached. * * Default is 64000. */ public static var keyLoadMaxRetryTimeout : Number = 64000; /** * fragmentLoadMaxRetry * * Max number of retries for Fragment Loading in case I/O errors are met, * 0, means no retry, error will be triggered automatically * -1 means infinite retry * * Default is 3 */ public static var fragmentLoadMaxRetry : int = 3; /** * fragmentLoadMaxRetryTimeout * * Maximum Fragment retry timeout (in milliseconds) in case I/O errors are met. * Every fail on fragment request, player will exponentially increase the timeout to try again. * It starts waiting 1 second (1000ms), than 2, 4, 8, 16, until fragmentLoadMaxRetryTimeout is reached. * * Default is 4000 */ public static var fragmentLoadMaxRetryTimeout : Number = 4000 /** * fragmentLoadSkipAfterMaxRetry * * control behaviour in case fragment load still fails after max retry timeout * if set to true, fragment will be skipped and next one will be loaded. * If set to false, an I/O Error will be raised. * * Default is true. */ public static var fragmentLoadSkipAfterMaxRetry : Boolean = true; /** * flushLiveURLCache * * If set to true, live playlist will be flushed from URL cache before reloading * (this is to workaround some cache issues with some combination of Flash Player / IE version) * * Default is false */ public static var flushLiveURLCache : Boolean = false; /** * manifestLoadMaxRetry * * max nb of retries for Manifest Loading in case I/O errors are met, * 0, means no retry, error will be triggered automatically * -1 means infinite retry */ public static var manifestLoadMaxRetry : int = 3; /** * manifestLoadMaxRetryTimeout * * Maximum Manifest retry timeout (in milliseconds) in case I/O errors are met. * Every fail on fragment request, player will exponentially increase the timeout to try again. * It starts waiting 1 second (1000ms), than 2, 4, 8, 16, until manifestLoadMaxRetryTimeout is reached. * * Default is 64000 */ public static var manifestLoadMaxRetryTimeout : Number = 64000; /** * startFromBitrate * * If greater than 0, specifies the preferred bitrate. * If -1, and startFromLevel is not specified, automatic start level selection will be used. * This parameter, if set, will take priority over startFromLevel. * * Default is -1 */ public static var startFromBitrate : Number = -1; /** * startFromLevel * * start level : * from 0 to 1 : indicates the "normalized" preferred level. As such, if it is 0.5, the closest to the middle bitrate will be selected and used first. * -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment) * -2 : playback will start from the first level appearing in Manifest (not sorted by bitrate) * * Default is -1 */ public static var startFromLevel : Number = -1; /** * autoStartMaxDuration * * max fragment loading duration in automatic start level selection mode (in ms) * -1 : max duration not capped * other : max duration is capped to avoid long playback starting time * * Default is -1 */ public static var autoStartMaxDuration : Number = -1; /** * seekFromLevel * * Seek level: * from 0 to 1: indicates the "normalized" preferred bitrate. As such, if it is 0.5, the closest to the middle bitrate will be selected and used first. * -1 : automatic start level selection, keep previous level matching previous download bandwidth * * Default is -1 */ public static var seekFromLevel : Number = -1; /** * useHardwareVideoDecoder * * Use hardware video decoder: * it will set NetStream.useHardwareDecoder * refer to http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#useHardwareDecoder * * Default is true */ public static var useHardwareVideoDecoder : Boolean = true; /** * logInfo * * Defines whether INFO level log messages will will appear in the console * * Default is true */ public static var logInfo : Boolean = true; /** * logDebug * * Defines whether DEBUG level log messages will will appear in the console * * Default is false */ public static var logDebug : Boolean = false; /** * logDebug2 * * Defines whether DEBUG2 level log messages will will appear in the console * * Default is false */ public static var logDebug2 : Boolean = false; /** * logWarn * * Defines whether WARN level log messages will will appear in the console * * Default is true */ public static var logWarn : Boolean = true; /** * logError * * Defines whether ERROR level log messages will will appear in the console * * Default is true */ public static var logError : Boolean = true; } }
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mangui.hls { import org.mangui.hls.constant.HLSSeekMode; import org.mangui.hls.constant.HLSMaxLevelCappingMode; public final class HLSSettings extends Object { /** * autoStartLoad * * if set to true, * start level playlist and first fragments will be loaded automatically, * after triggering of HlsEvent.MANIFEST_PARSED event * if set to false, * an explicit API call (hls.startLoad()) will be needed * to start quality level/fragment loading. * * Default is true */ public static var autoStartLoad : Boolean = true; /** * capLevelToStage * * Limit levels usable in auto-quality by the stage dimensions (width and height). * true - level width and height (defined in m3u8 playlist) will be compared with the player width and height (stage.stageWidth and stage.stageHeight). * Max level will be set depending on the maxLevelCappingMode option. * false - levels will not be limited. All available levels could be used in auto-quality mode taking only bandwidth into consideration. * * Note: this setting is ignored in manual mode so all the levels could be selected manually. * * Default is false */ public static var capLevelToStage : Boolean = false; /** * maxLevelCappingMode * * Defines the max level capping mode to the one available in HLSMaxLevelCappingMode * HLSMaxLevelCappingMode.DOWNSCALE - max capped level should be the one with the dimensions equal or greater than the stage dimensions (so the video will be downscaled) * HLSMaxLevelCappingMode.UPSCALE - max capped level should be the one with the dimensions equal or lower than the stage dimensions (so the video will be upscaled) * * Default is HLSMaxLevelCappingMode.DOWNSCALE */ public static var maxLevelCappingMode : String = HLSMaxLevelCappingMode.DOWNSCALE; // // // // // // ///////////////////////////////// // // org.mangui.hls.stream.HLSNetStream // // // // // // // ///////////////////////////////// /** * minBufferLength * * Defines minimum buffer length in seconds before playback can start, after seeking or buffer stalling. * * Default is -1 = auto */ public static var minBufferLength : Number = -1; /** * minBufferLengthCapping * * Defines minimum buffer length capping value (max value) if minBufferLength is set to -1 * * Default is -1 = no capping */ public static var minBufferLengthCapping : Number = -1; /** * maxBufferLength * * Defines maximum buffer length in seconds. * (0 means infinite buffering) * * Default is 120 */ public static var maxBufferLength : Number = 120; /** * maxBackBufferLength * * Defines maximum back buffer length in seconds. * (0 means infinite back buffering) * * Default is 30 */ public static var maxBackBufferLength : Number = 30; /** * lowBufferLength * * Defines low buffer length in seconds. * When crossing down this threshold, HLS will switch to buffering state. * * Default is 3 */ public static var lowBufferLength : Number = 3; /** * mediaTimeUpdatePeriod * * time update period in ms * period at which HLSEvent.MEDIA_TIME will be triggered * Default is 100 ms */ public static var mediaTimePeriod : int = 100; /** * fpsDroppedMonitoringPeriod * * dropped FPS Monitor Period in ms * period at which nb dropped FPS will be checked * Default is 5000 ms */ public static var fpsDroppedMonitoringPeriod : int = 5000; /** * fpsDroppedMonitoringThreshold * * dropped FPS Threshold * every fpsDroppedMonitoringPeriod, dropped FPS will be compared to displayed FPS. * if during that period, ratio of (dropped FPS/displayed FPS) is greater or equal * than fpsDroppedMonitoringThreshold, HLSEvent.FPS_DROP event will be fired * Default is 0.2 (20%) */ public static var fpsDroppedMonitoringThreshold : Number = 0.2; /** * capLevelonFPSDrop * * Limit levels usable in auto-quality when FPS drop is detected * i.e. if frame drop is detected on level 5, auto level will be capped to level 4 a * true - enabled * false - disabled * * Note: this setting is ignored in manual mode so all the levels could be selected manually. * * Default is false */ public static var capLevelonFPSDrop : Boolean = false; /** * smoothAutoSwitchonFPSDrop * * force a smooth level switch Limit when FPS drop is detected in auto-quality * i.e. if frame drop is detected on level 5, it will trigger an auto quality level switch * to level 4 for next fragment * true - enabled * false - disabled * * Note: this setting is active only if capLevelonFPSDrop==true * * Default is true */ public static var smoothAutoSwitchonFPSDrop : Boolean = true; /** * seekMode * * Defines seek mode to one form available in HLSSeekMode class: * HLSSeekMode.ACCURATE_SEEK - accurate seeking to exact requested position * HLSSeekMode.KEYFRAME_SEEK - key-frame based seeking (seek to nearest key frame before requested seek position) * * Default is HLSSeekMode.KEYFRAME_SEEK */ public static var seekMode : String = HLSSeekMode.KEYFRAME_SEEK; /** * keyLoadMaxRetry * * Max nb of retries for Key Loading in case I/O errors are met, * 0, means no retry, error will be triggered automatically * -1 means infinite retry * * Default is 3 */ public static var keyLoadMaxRetry : int = 3; /** * keyLoadMaxRetryTimeout * * Maximum key retry timeout (in milliseconds) in case I/O errors are met. * Every fail on key request, player will exponentially increase the timeout to try again. * It starts waiting 1 second (1000ms), than 2, 4, 8, 16, until keyLoadMaxRetryTimeout is reached. * * Default is 64000. */ public static var keyLoadMaxRetryTimeout : Number = 64000; /** * fragmentLoadMaxRetry * * Max number of retries for Fragment Loading in case I/O errors are met, * 0, means no retry, error will be triggered automatically * -1 means infinite retry * * Default is 3 */ public static var fragmentLoadMaxRetry : int = 3; /** * fragmentLoadMaxRetryTimeout * * Maximum Fragment retry timeout (in milliseconds) in case I/O errors are met. * Every fail on fragment request, player will exponentially increase the timeout to try again. * It starts waiting 1 second (1000ms), than 2, 4, 8, 16, until fragmentLoadMaxRetryTimeout is reached. * * Default is 4000 */ public static var fragmentLoadMaxRetryTimeout : Number = 4000 /** * fragmentLoadSkipAfterMaxRetry * * control behaviour in case fragment load still fails after max retry timeout * if set to true, fragment will be skipped and next one will be loaded. * If set to false, an I/O Error will be raised. * * Default is true. */ public static var fragmentLoadSkipAfterMaxRetry : Boolean = true; /** * flushLiveURLCache * * If set to true, live playlist will be flushed from URL cache before reloading * (this is to workaround some cache issues with some combination of Flash Player / IE version) * * Default is false */ public static var flushLiveURLCache : Boolean = false; /** * manifestLoadMaxRetry * * max nb of retries for Manifest Loading in case I/O errors are met, * 0, means no retry, error will be triggered automatically * -1 means infinite retry */ public static var manifestLoadMaxRetry : int = 3; /** * manifestLoadMaxRetryTimeout * * Maximum Manifest retry timeout (in milliseconds) in case I/O errors are met. * Every fail on fragment request, player will exponentially increase the timeout to try again. * It starts waiting 1 second (1000ms), than 2, 4, 8, 16, until manifestLoadMaxRetryTimeout is reached. * * Default is 64000 */ public static var manifestLoadMaxRetryTimeout : Number = 64000; /** * startFromBitrate * * If greater than 0, specifies the preferred bitrate. * If -1, and startFromLevel is not specified, automatic start level selection will be used. * This parameter, if set, will take priority over startFromLevel. * * Default is -1 */ public static var startFromBitrate : Number = -1; /** * startFromLevel * * start level : * from 0 to 1 : indicates the "normalized" preferred level. As such, if it is 0.5, the closest to the middle bitrate will be selected and used first. * -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment) * -2 : playback will start from the first level appearing in Manifest (not sorted by bitrate) * * Default is -1 */ public static var startFromLevel : Number = -1; /** * autoStartMaxDuration * * max fragment loading duration in automatic start level selection mode (in ms) * -1 : max duration not capped * other : max duration is capped to avoid long playback starting time * * Default is -1 */ public static var autoStartMaxDuration : Number = -1; /** * seekFromLevel * * Seek level: * from 0 to 1: indicates the "normalized" preferred bitrate. As such, if it is 0.5, the closest to the middle bitrate will be selected and used first. * -1 : automatic start level selection, keep previous level matching previous download bandwidth * * Default is -1 */ public static var seekFromLevel : Number = -1; /** * useHardwareVideoDecoder * * Use hardware video decoder: * it will set NetStream.useHardwareDecoder * refer to http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#useHardwareDecoder * * Default is true */ public static var useHardwareVideoDecoder : Boolean = true; /** * logInfo * * Defines whether INFO level log messages will will appear in the console * * Default is true */ public static var logInfo : Boolean = true; /** * logDebug * * Defines whether DEBUG level log messages will will appear in the console * * Default is false */ public static var logDebug : Boolean = false; /** * logDebug2 * * Defines whether DEBUG2 level log messages will will appear in the console * * Default is false */ public static var logDebug2 : Boolean = false; /** * logWarn * * Defines whether WARN level log messages will will appear in the console * * Default is true */ public static var logWarn : Boolean = true; /** * logError * * Defines whether ERROR level log messages will will appear in the console * * Default is true */ public static var logError : Boolean = true; } }
disable capLevelonFPSDrop feature
disable capLevelonFPSDrop feature it is currently broken
ActionScript
mpl-2.0
neilrackett/flashls,jlacivita/flashls,fixedmachine/flashls,hola/flashls,jlacivita/flashls,neilrackett/flashls,codex-corp/flashls,vidible/vdb-flashls,vidible/vdb-flashls,clappr/flashls,codex-corp/flashls,mangui/flashls,hola/flashls,NicolasSiver/flashls,NicolasSiver/flashls,mangui/flashls,fixedmachine/flashls,tedconf/flashls,clappr/flashls,tedconf/flashls