[web] Advanced layering (new to flash)

This topic is 2806 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I'm no newcomer to programming in general, so the code itself doesn't intimidate me, but since I have a rather strange idea that I'm having difficulty pushing through at my work place, I've snuck my way to a CS5 workstation and am now trying to figure out how to build up a working demo myself.

Since the overall framework of Flash is remaining kind of elusive to me, I'd like to read some practical introductory stuff on it - eg how do I set up my project, why the Document.as file gets executed despite the fact that I can't find it listed in the project (coming from VS, this is slightly confusing), etc. If anyone can recommend one resource above all others in this respect, I'd aprpeciate it!

Moreover, as the first step I need to get a 3D scene running on top of a video, which is proving to be rather frustrating because, as it seems, the masking and layering bit isn't proving to be that intuitive to me. I can get both of the layers to work individually, but I can't get masking to work in the 3D scene so that it would show up on top of my video with unfilled background remaining transparent (the video seems to be always drawn on top). I know this isn't a very in-depth description of the problem, but I'm guessing the answer here is more likely a very simple one.

edit: fixed typos and such

[Edited by - irreversible on October 14, 2010 1:43:23 AM]

Share on other sites
I moved away from CS in favor of FlashDevelop since version 3, so don't ask me any interface specific questions. :)

What are you using for 3D, a third party library (Papervision, Away3D) or the native semi-3D Flash stuff?

If the 3D scene is contained within a DisplayObject (or something inheriting from it), it should be theoretically possible to generate a mask each frame by copying the frame contents to a new DisplayObject, possibly reduce its depth to 2 bits (I think black equals transparent) and set it as the container's mask.

As an intermediate step: have you tried to display a simple bit masked image over the video? If that fails too, the video 'object' might be the problem.

Share on other sites
I'm using built-in functionality only, so no third party stuff. I'll try out the bitmap layering tomorrow. I haven't been on it for a few days now, but as far as I remember - if I turned the 3D layer into a mask and painted stuff on it, it did act as a mask on top of the video. I'll verify that tomorrow, though!

BTW - would I do well to consider taking this up in FlashDevelop as well?

Share on other sites
So, then - turns out I was using Papervision before. However, now I have a number of layers, two of which are a video layer and a native (pseudo) 3D layer. Regardless of the order in which I set up my layers, though, the video always appears on top of everything else (I also tried a regular image layer as you suggested). Here's the action script for the video layer:

import flash.system.Security;import flash.display.Loader;import flash.net.URLRequest;Security.allowDomain("www.youtube.com");flash.system.Security.allowDomain("*");var my_player:Object;var my_loader:Loader = new Loader();my_loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3")); my_loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);function onLoaderInit(e:Event):void{	addChild(my_loader);	my_player = my_loader.content;	my_player.addEventListener("onReady", onPlayerReady); } function onPlayerReady(e:Event):void{	my_player.setSize(640,360);	my_player.loadVideoById("_OBlgSz8sSM",0);}

Any suggestions?

PS - how the heck do I enable flash to access the web without adding an exception? Will this happen automatically when I publish the swf on a server?

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 14
• 12
• 9
• 12
• 37
• Forum Statistics

• Total Topics
631425
• Total Posts
3000011
×