Iphone + flash
Everyone understands that it’s very bad for Apple to let Adobe have flash player in iPhone’s Safari. I bet it will harm a lot App Store, especially games, because of millions of free flash games over the Web. If an iPhone is powerful enough to run them is another question though.
This is apparently how Adobe begs Apple to let iPhone have flash player installed.
And that CS5 will be able to publish to iPhone surprised me a lot. But after some thinking it seems that Flash to iPhone publishing is much better for Apple than it may seem. It is another free (free for Apple) platform to develop apps which requires developers’ license too and all apps are subject to App Store censorship. More apps — more money.
And mean while, here are two links to Mike Chambers’ posts where you can find more information about Flash to iPhone publishing.
FITC Edmonton Slides : Building iPhone applications with Flash CS5
Resources for Learning more about Flash to iPhone
Open Source Media Framework
First time when I heard about Adobe Open Source Media Framework I didn’t really understand what it was about. So I’ve never researched deeper into it. But after I watched this video presentation from MAX (yes, I’m slow, watching 1-2 videos a day) I can sign under every word the guys say. Some time soon I’ll download current release and play with it. And I’m sure I’ll be an active user and contributor.
Last year I spent developing a custom video players framework in which I partly succeeded. I got like 60% of main features working with a cool IoC and MVC framework. But one busy developer definitely wasn’t enough to build and fully test complete framework. I faced a lot of challenges and problems. Seriously, sometimes I hated Adobe for such weird things like NetConnection and NetStream.
Now I see the great job the guys did with OSMF. This project is like 3 years late and could have saved me a lot of time.
Continue Reading | No Comments
Tags: Adobe MAX, NetConnection, NetStream, OSMF, Video player
Order of Operations in ActionScript
Great tutorial from Trevor senocular McCauley titled Order of Operations in ActionScript. Must read for advanced programmers even if you think that you know everything already.
Null, undefined and NaN
A newbie in ActionScript3 might wonder why there are 3 different values which mean “nothing”. I’ll try to explain the difference.
Something is null when it points to nothing. If you remember that by saying
var p: Point = new Point();
we create a reference (pointer) p to a position in memory which has the created Point object. This pointer is typed so can reference only objects of type Point. If we write
p = 42 as Point;
flash can’t convert 42 to Point so p just points to nothing in memory thus it is null.
If we write something like
var i:int = (new Point()) as int;
i will be 0 because int variable is of so-called simple type and contains its value not points to some memory space.
But what about undefined? Remember that in ActionScript we can have dynamic classes and untyped variables. For example this is an untyped variable definition:
var untyped: *;
While it’s not set it is undefined because it neither points to anything nor it contains a simple value. It is just not defined yet. All typed variables have default values which is usually null. Also we get undefined when referencing a non-existing property of a dynamic object.
trace( {}.x ); // empty Object
trace( [][1] ); // empty Array
both will trace undefined. This is quite interesting, because here if you don’t understand the difference between null and undefined you can get unusual results. Let’s check an example.
var o: Object = {x: null};
trace( o.x );
trace( !o.x );
trace( o.y );
trace( !o.y );
This will trace
null
true
undefined
true
x property exists in object o but it points to nothing, but y property doesn’t exist at all. If you test something for existence using this approach you are missing the point. You should use === instead, because
null == undefined; // true null === undefined; // false
Now what is NaN. NaN states for Not a Number. It’s a value which a variable of type Number can hold meaning that it holds something which is not a number. This is how you can get NaN:
Number( "hello" ); 0/0; Math.sqrt( -1 );
The only way you can check if your variable holds NaN is isNaN() global function. You can’t say
something == NaN;
because comparing to NaN always results in false. Even
NaN == NaN
is false.
There’s another value for Numbers you should know — Infinity. You can get it if you divide something by 0.
OK, let’s do our final test.
private var undef: *;
...
trace( {}.x ); // undefined
trace( undef ); // undefined
trace( [][1] ); // undefined
trace( Number( "hello" ) ); // NaN
trace( 0/0 ); // NaN
trace( Math.sqrt( -1 ) ); // NaN
trace( 1/0 ); // Infinity
trace( NaN == undefined ); // false
trace( NaN === undefined ); // false
trace( null == undefined ); // true
trace( null === undefined ); // false
trace( NaN == NaN ); // false
trace( NaN === NaN ); // false
trace( null == null ); // true
trace( null === null ); // true
trace( undefined == undefined ); // true
trace( undefined === undefined ); // true
Why not Unity3d use Flash?
Flash could be great in Unity3d for interfaces, minigames and even animated textures. They should definitely research the possibility of using it. Maybe it’s possible to write a custom Flash Player how the guys from Scaleform did.
Speed vs. OOP
As I found out, AS3 compiler is too stupid to add even trivial optimizations.
I’ve been trying to optimize one of my heavy libraries I use everywhere for some time. It parses a lot of XML using e4x and creates many objects which it has to check using isSomething() function which is just 3 lines of code. So, this function is executed for every single object created.
Let’s check the test now.
var t: int;
var v: int = 5;
var w: int = 6;
for ( var i: int = 0; i < 5; i++ )
{
t = getTimer();
for ( var j: int = 0; j < 1000000; j++ )
{
var k: Boolean = func( v, w );
//var k: Boolean = v > w;
}
trace( getTimer() - t );
}
private function func( v: int, w: int ): Boolean
{
return v > w;
}
This executes on my Macbook Pro for 400ms.
If you uncomment the second line and comment the first one, execution time drops to 90-100ms. Which is 4 times less. But this is for 100000 calls, you can say. Remember that 30fps = 33ms for every frame, so one millisecond here and one millisecond there give noticeable result. And as I said the same short function is executed for every object. And there can be a lot of them. Though I don’t have to do it every frame but I don’t want my application freeze in the beginning either.
Moreover,
var t: int;
for ( var i: int = 0; i < 5; i++ )
{
t = getTimer();
for ( var j: int = 0; j < 1000000; j++ )
{
var k: int = value;
//var k: int = _value;
}
trace( getTimer() - t );
}
public function get value(): int
{
return _value;
}
it’s the same for getters and setters because they are also functions.
So I just replaced all calls of this function for actual code (6 occurrences). Every programmer who knows OOP will say that it’s bad to copy and paste code, if he doesn’t know why I did that. He might also go post on the forums that I am a noob, make a function of these pasted code snippets and will be proud of himself.
Here’s the question. Speed or OOP? While AS3 compiler is so dumb and can’t inline simple functions like this I’ll have to break readability in favor of execution speed.
Tags: Framework, Inline, OOP, Optimization, XML
mxmlc, ant and metadata
Just not to forget how to make mxmlc and task save my custom metadata.
<target name="compile.test" >
<mxmlc file="${source.dir}/TestsLauncher.mxml" output="${bin.dir}/tests/TestsRunner.swf" keep-generated-actionscript="false">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks" />
<source-path path-element="${source.dir}" />
<compiler.library-path dir="${libs.dir}" append="true" >
<include name="fluint.swc" />
<include name="alcon.swc" />
</compiler.library-path>
<keep-as3-metadata name="Meta1"/>
<keep-as3-metadata name="Meta2"/>
</mxmlc>
</target>
What do you think about me?
Of course everyone saw the site. Some of you like it, others don’t. When my internal energy depletes (which doesn’t happen often), looking for inspiration I open valyard.ru. I know it’s strange to steal back energy from your own creation where you put your own creative energy before. But it seems that this half a year I’ve been working on it I put there so much that I am using it even now.
And here are some of feedback messages I got since the launch.
***
what the hell?
***
What a good use of creative juice, It’s really just too bad you never thought of the other 80% of web surfers who can’t see it.
***
congrats on the FWA. loving the whole vibe of the site.
***
im a student from america, im jelous of your skill
***
what the hell is going on with thefwa judges !?
***
Create flash website, really well done design and all. Keep up the good work.
***
powerful slick website.
haven’t seen such a nice website for ages now. keep it up!
***
Overall the graphics included the logo and first of all the typography are really really unaesthetic . Graphics: past time flash intro style / Typo: finally unreadable. So, hopefully your coding skills are much better…
***
unusable, and unreadable.
***
Very great !!
Congratulations !
***
I can’t get the fwa judges desicion and personally don’t like it very much but lots o effort goes around here and site has a good amatour feeling
***
Is this a pathetic joke?
***
i’m sorry but i don’t like your site. the ergonomy is no good at all, the text is unreadable, and i really don’t understan d why you got an FWA SOTD…
***
I’m sure you can program quite well, but I feel as though you’ve turned away a lot of people by making them wait for the site to load. There is also way too much going on, I can barely focus on typing. No contrast, either.
***
It’s really unusable. I realize this is a place for”you” and what you like, but you’re going to scare away potential clients by connecting it with your biz.
***
I like the design but the readability is poor. I went through the portfolio and I see that U do more than just web sites. Overal 9/10 :)
***
this is fucking good!
***
This is the most amazing website made with flash I ever seen. Love the colours, the music… the whole theme is great! I hope to be able to do something like that someday!
***
This is a very diferent site. Great design, colors, interactions, sounds and fun. Good job indeed.
***
G R E A T ! !
RESPECT!
***
Programming skills and audio abilities are very nice. Design application / readability / navigation is pretty lame though and not very practical.
***
This website is extraordinary terrible. Can’t even read a thing and the colors make my eyes bleed. Keep on coding but please don’t put your hands on graphics anymore. Definitely not worth any award.
***
AWESOME! Teach me your ways!? :P
***
THIS IS THE WORST SITE I HAVE EVER SEEN!!!!
***
There is such a thing as too much going on!! This is really terrible. Flash isnt considered high art or anything but no need to drag it thru the gutters! This style hasnt been remotely popular for ten years too btw.
***
Nice work, looks great, Im full of admire.
***
that this site got an FWA has to be a joke.
***
This site is SO Ace Frehley…
***
Great pprogramming / sound / and bravery. Not so great design / practicality / usefulness. But none the less, you are more skilled than I :)
***
Holy Crap dude, my monitor is about to explode! Amazing detail
***
Nice website, good job :)
***
waaaaaaaaay too much faff for pretty standard content. can’t see why it’s got fwa… sorry
***
Dear Valentin, Your are an amazing Flash design programmer. I run a creative firm in Dubai, UAE. I look upon you as an inspiration to create.
***
A nice work, I really feel an inspiration on planet of the drums(older version) from weworkforthem. Never the less a good work
***
amazing skills bro, I must say I hate the colors or maybe just the purplepink
***
Colors, design, animation… everything is brillant! :)
***
Thank you for the inspiration. I have just decided on a web host, and am now keen to look at building a flash based website. Give me pointers !
***
Mad props for the tech side of the site….. but the design is the worst thing i’ve seen in a while….. for real…. what up with all the brushes dude?
anyway….. except for that comment… this shit rocks!!!
***
very artistic. too busy though.
***
i dont enjoy the layout and colors but i must say you have superb scripting skills..keep it up!!
***
So COOL!!
***
Ya your a coder not a designer good code. Your still stuck in 1999 design. Try going to a design class to step up your game.
***
omg, what a creative abstractivity, great work lad
***
I thought this style died forever after its bloom in 1999-2001… Nothing new, but I’m glad to see it again after this huge wave of minimalism…
***
hey man ur site is very very nice yaaar…..
***
took me one hour to get in but after visiting i think its one of the most amazing performance of the year
***
tienes buena programacion, donde aprendiste
***
DAMNNNNNNN!!!!!!! its its damn!!! I need a tutor like you! is it possible?
***
Alien Science!!! love the ripple effect
***
I really like the effects – the ripple effect is cool! – but your color scheme is awful. The white text on the light blue back ground is difficult to read at best. I’m not even going to go into the navigation – RIDICULOUS!!!
***
man……this doesn’t look very new. Also I’m not a fan of the colors you have chosen. I’ve seen all of your background art on istockphoto.com
***
Muy interesante todo lo que realizas, tienes mucho talento!
***
Wow mate you’ve got it going on, never seen anything like your site before, very good well done .
***
its a russian solution to a russian problem i guess…
***
Wow- is this real or what…!
***
mmm feels like 90′s flash revenge!!
***
amazing! it feels like i’m in a futuristic world.
***
Great! the color the style the man you!
***
Great Site, I am a Graphic Student and just being introduced to Flash this is very inspriring!
***
GARBAGE. THIS SITE IS PURE GARBAGE
***
hey… your concept just like my website !!!! but mine still rich sound and kick-ass graphic than yours !!! go to hell !!!my
***
Jesus Christ, your website is the best (and bad for read) that i’ve ever seen! Anyway, your site really kick ass! Congratulations!
***
Making diiferent is something different for the normal people. I like your site buddy! Cool
***
Love the design and feel of the site, very unique and I LIKE that it is not easy to use. Very innovative in every sense of the word.
***
This site is awesome, gave me something interesting to study in my media class.
***
holy crap man. this is the gayest shit i’ve ever seen. this is so 1998 and to add to the insult you outputted it for a minimum of 1280×960
***
Just started studying multimedia designs myself, and you are by far the biggest flash motivation and inspiration sorce i’ve got so far!
***
damn dude, awsome.
Continue Reading | No Comments
Tags: Energy, Feedback, valyard.ru
Importing assets
Separating graphical/sound assets and actual logic is a very good practice. It allows to avoid a lot of problems. For some time I’ve been using compiled SWFs with ActionScript skin classes embeding symbols from that SWF using [Embed] meta tag. But recently I came across much better solution using SWC.
So the algorithm is the following:
- Create a new AS project in Flex Builder.
- Create a new FLA at ‘assets/assets.fla’.
- In Publish Settings of that FLA set ‘Export SWC’ checkbox.
- Create and export assets via ‘linkage properties’ as something like ‘assets.MySymbol’.
- Publish SWC.
- In Flex Builder add this SWC at Project -> Properties-> ActionScript Build Path -> Library Path -> Add SWC.
- Now in Flex Builder we can import and use assets.MySymbol and IDE knows about it and its type.
Flex on Rails is too fast
Ruby on Rails evolves so fast that at version 2.3.2 all the code from a year 2008 book doesn’t work in April 2009.
Well, Flex + Ruby on Rails is great, the speed with which simple applications are made is astonishing. I’m reading right now Flex on Rails: Building Rich Internet Applications with Adobe Flex 3 and Rails 2 and as I said every once and a while I get stuck into compatibility problem.
Right now the problem is the following — in Flex HTTPService class though it says that method = “GET|POST|PUT|DELETE”, but the actual data is sent with GET or POST (for some reason I’m sure that 90% users don’t even know that PUT and DELETE exist). But in case with RoR they are essential, for example GET accounts/1 returns account information, PUT accounts/1 updates account and DELETE accounts/1 deletes an account. The book says just that and as a workaround it suggests to add ?_method=put to URL. But in 2.3.2 it doesn’t work anymore. Trying to do that we get
ActionController::MethodNotAllowed (Only get, put, and delete requests are allowed.)
Google says that I should to send method=put with request itself. Requests are sent in XML but I can’t have 2 roots in AS3 XML, so <_method>put</_method><data /> doesn’t work. Wrapping the whole construct into another root fails.
After googling a bit more I found out that I must set header HTTP_X_HTTP_METHOD_OVERRIDE = PUT. But it didn’t work. I almost gave up but visited this chinese link where our communist friend solved the problem!. It seems that Rails somehow adds to headers another HTTP_ prefix and doesn’t know what to do with things like HTTP_HTTP_X_HTTP_METHOD_OVERRIDE = PUT.
So, here’s the code which works
<mx:HTTPService id=”accountsUpdate”
url=”{CONTEXT_URL}/accounts/{accountsGrid.selectedItem.id}”
method=”POST” resultFormat=”e4x” contentType=”application/xml” headers=”{{X_HTTP_METHOD_OVERRIDE: ‘PUT’}}” >
</mx:HTTPService>
I hope that this text helps people trying to learn Ruby on Rails and how it works with Flex.
Tags: 2.3.2, Flex, Flex on Rails, Headers, HTTP, HTTPService, RoR, Ruby, X_HTTP_METHOD_OVERRIDE
