This morning I came across some strange sort-of overload workaround that can cast your class to any type. Imagine you want to have a reference to a boolean. You have to “box” it then. It look like this:
[as]class BoxedBoolean
{
private var value: Boolean;
public function BoxedBoolean( value: Boolean )
{
this.value = value;
}
}[/as]
Now doing something like if ( boxedBoolean == true ) is not possible since boxedBoolean is type BoxedBoolean. Even though the value we want to use is a boolean value. So here is the workaround:
[as]class BoxedBoolean
{
private var value: Boolean;
public function BoxedBoolean( value: Boolean )
{
this.value = value;
}
public function toString(): Boolean
{
return value;
}
}[/as]
Do not ask me what strange nature toString() has but it works. Now the only problem with this is that if ( a == true ) works fine but if ( a ) is always true.
Here is an example
[as]var b0: BoxedBoolean = new BoxedBoolean( true );
var b1: BoxedBoolean = new BoxedBoolean( false );
trace( b0 is Boolean );
trace( b1 is Boolean );
trace( b0 );
trace( b1 );
if ( b0 == true )
trace( ‘b0 = true’ );
else
trace( ‘b0 = false’ );
if ( b1 == true )
trace( ‘b1 = true’ );
else
trace( ‘b1 = false’ );[/as]
The trace output is then
false
false
true
false
b0 = true
b1 = false
If you remove the == true you will get that both b0 and b1 are true. I do not think that there is much use for it but it is interesting what you can do. toString() can also return an integer and it works as well.
This morning I came across some strange sort-of overload workaround that can cast your class to any type. Imagine you want to have a reference to a boolean. You have to "box" it then. It look like this:
[as]class BoxedBoolean
{
private var value: Boolean;
public function BoxedBoolean( value: Boolean )
{
this.value = value;
}
}[/as]
Now doing something like if ( boxedBoolean == true ) is not possible since boxedBoolean is type BoxedBoolean. Even though the value we want to use is a boolean value. So here is the workaround:
[as]class BoxedBoolean
{
private var value: Boolean;
public function BoxedBoolean( value: Boolean )
{
this.value = value;
}
public function toString(): Boolean
{
return value;
}
}[/as]
Do not ask me what strange nature toString() has but it works. Now the only problem with this is that if ( a == true ) works fine but if ( a ) is always true.
Here is an example
[as]var b0: BoxedBoolean = new BoxedBoolean( true );
var b1: BoxedBoolean = new BoxedBoole
Three days ago there was some news about an online version of Adobe Photoshop. Today I read on a German news site that they will probably use Flex. I am so excited about that news and I am looking forward to try their product. Of course I have a special interest in this because I developed my own library and now the big boys do it.
It will also be very interesting to see what they will do about some issues. If you want to edit a picture (like 6megapixel picture) it will be a big fight against stuff like the maximum execution time. Probably they will use an approach to filter an image over more than one frame. So it would be possible – just like Photoshop does – to see a progress of that thing. But even in that case such a filter would take you at least half a minute of waiting to complete. Maybe they will start working on some performance issues of the Flash player as well..?!
Anyways I can’t wait to see this in action!
Update: I am quiet sure that we will see two techniques here. One will definitly be connected to Event.ENTER_FRAME for extensive x,y-loops and a lot of getPixel()/setPixel() calls. The second method is also connected to Event.ENTER_FRAME and goes rectangle by rectangle for stuff like paletteMap(). Just speculations. We will see more in six months.
Three days ago there was some news about an online version of Adobe Photoshop. Today I read on a German news site that they will probably use Flex. I am so excited about that news and I am looking forward to try their product. Of course I have a special interest in this because I developed my own library and now the big boys do it.
It will also be very interesting to see what they will do about some issues. If you want to edit a picture (like 6megapixel picture) it will be a big fight against stuff like the maximum execution time. Probably they will use an approach to filter an image over more than one frame. So it would be possible - just like Photoshop does - to see a progress of that thing. But even in that case such a filter would take you at least half a minute of waiting to complete. Maybe they will start working on some performance issues of the Flash player as well..?!
Anyways I can't wait to see this in action!
Update: I am quiet sure that we will see two techniques here. One will definitly