Skip to content

Instantly share code, notes, and snippets.

View hyzhak's full-sized avatar
🤔
feel creative

Ievgenii Krevenets hyzhak

🤔
feel creative
View GitHub Profile
private var rc:Number = 1/3, gc:Number = 1/3, bc:Number = 1/3;
private var sf:ColorMatrixFilter = new ColorMatrixFilter([rc, gc, bc, 0, 0, rc, gc, bc, 0, 0, rc, gc, bc, 0, 0, 0, 0, 0, 1, 0]);
private function blackAndWhite(target:UIComponent, enabled:Boolean):void
{
if(enabled) target.filters = [sf];
else target.filters = [];
}
Error: 201, Unable to load stream or clip file, connection failed, clip: '[Clip] 'myStream''
at org.flowplayer.view::Launcher/doHandleError()
at org.flowplayer.view::Launcher/onClipError()
at EventListener/notify()
at org.flowplayer.model::EventDispatcher/_dispatchEvent()
at org.flowplayer.model::EventDispatcher/http://flowplayer.org/core/internal::doDispatchErrorEvent()
at org.flowplayer.model::EventDispatcher/http://flowplayer.org/core/internal::doDispatchEvent()
at org.flowplayer.model::Clip/onClipEvent()
at EventListener/notify()
at org.flowplayer.model::EventDispatcher/_dispatchEvent()
@hyzhak
hyzhak / gist:1122978
Created August 3, 2011 15:51
Create a variable right inside an expression
var a:Number = 1;
var b:Number = 2;
var c:Number = 3;
if((a = b + c) > 1)
{
trace("!");
}
trace("a="+a);
@hyzhak
hyzhak / HamcrestTest.as
Created June 8, 2012 11:56
Test hamcrest.as to compare two ByteArrays
import org.hamcrest.assertThat;
import org.hamcrest.object.equalTo;
/**
* Test failed with message:
*
* Error: Expected: <test.string>
* but: was <test.string>
*
*/
@hyzhak
hyzhak / TestCompareTwoArrays.as
Created June 8, 2012 12:37
Compare two arrays with same contents, but with different order in hamcrest-as.
import org.hamcrest.assertThat;
import org.hamcrest.collection.arrayWithSize;
import org.hamcrest.collection.everyItem;
import org.hamcrest.collection.inArray;
/**
* Compare two arrays with same contents, but with different order in hamcrest-as.
*
* Does anybody have more shorter version?
*/
@hyzhak
hyzhak / gist:4233933
Created December 7, 2012 15:25
Questions to Thibault Imbert
Hello!
I was online on UAFPUG41 where you talk about future of Flash
Platform, but can't ask you about same basic question, If you don't
mind, can you answer:
1st
What about to give more control on Workers for example pause/resume
it, or give more/less priority. Example: When I run hard worker on
background (big scene on Box2D), it can get much resources, by I want
@hyzhak
hyzhak / cyclic.js
Last active December 17, 2015 04:59
Implementation of cyclic behaviour on darlingjs game engine
var m = darlingjs.m('ngCyclic');
/**
* Marker for entity with cyclic pattern behaviour
*/
m.$c('ngCyclic', {
/**
* PatternWidth, if value <= 0.0 that pattern doesn't cyclic in that direction
*/
patternWidth: 0.0,
@hyzhak
hyzhak / cyclic-world.js
Last active December 17, 2015 04:59
Usage of ngCyclic module of darlingjs for simulate cyclic bacgrounds
var w = darlingjs.w('theCyclicWorld', ['ngCyclic']);
//add systems for implement cyclic behaviour
world.$add('ng2DCyclicLayer');
world.$add('ngMarkIfOutsideOfTheViewPortVertical2D');
world.$add('ngMarkIfOutsideOfTheViewPortHorizontal2D');
world.$add('ngMarkIfInsideOfTheViewPortVertical2D');
world.$add('ngMarkIfInsideOfTheViewPortHorizontal2D');
//add entity
@hyzhak
hyzhak / parallax.js
Last active December 17, 2015 06:58
Implement parallax effect by project 3D to 2D
/**
* Component of position in 3D environment
*/
m.$c('ng3D', {
x: 0.0,
y: 0.0,
z: 0.0
});
/**
@hyzhak
hyzhak / infinite-surface-with-parallax.js
Last active December 17, 2015 06:59
Example of implementation of parallax effect on darlingjs game engine (http://darlingjs.github.io)
(function(darlingjs, darlingutil) {
'use strict';
var width = 640,
height = 480;
//Create game world
var world = darlingjs.w('theCyclicWorld', [
'ngFlatland',
'ngCyclic',
'ng3D',