Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




[F8] Drawing BitmapData With Masked Video



Hello. I am relatively new to flash and I only have a limited understanding of the language. Anyway, this is what I am trying to do:

I have a video which is masked. I want to take a snapshot of the mask. If this is not possible, the next best would be to unmask the video and just take a snapshot of the region the mask would be. Is there a way for me to do the latter? I have tried using the BitmapData draw() method on my mask, but it only returns a blank image of proper size, which I attribute to the fact that it is masked.

I am so confused!



FlashKit > Flash Help > Flash ActionScript
Posted on: 08-20-2007, 05:35 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

[as3] Drawing BitmapData To Erase BitmapData
Hey there. I'm still working on my paint program, and I figured I'd try using the open source, raster-based drawing system from Bytearray.org to speed up drawing in some of my paint tools. The Raster class has some drawing functions that don't bother with anti-aliasing, so in some situations, implementing these methods results in faster code than relying on the Graphics package. I've gotten a nice speed boost from my rainbow paintbrush, which is pretty neat. Go open source!

Unfortunately, I can't get the eraser brush to work, even though its code is essentially the same as the other brushes'. And I've figured out why; the "erase" and "alpha" blend modes, which my vector-based eraser uses to erase the drawing surface, don't seem to work when you draw one BitmapData object onto another. I could put the BitmapData in a Bitmap object and draw that, but that's essentially converting raster data to vector, and then back to raster, which is far slower than any speed improvement I'd get from relying on the Raster class in the first place.

Has anyone here succeeded in using one BitmapData object to erase another, without "wrapping" the eraser BitmapData in a Bitmap object?

BitmapData.draw With Sprites Masked By Blending Shapes
Hi there,

I'm working on a website, which contains lot of zoomable content. Due to performance reasons I have to generate a bitmap for every zoomed-out content. The contents contain lots of gradient shapes used as alpha-masks (blendMode="erase"). My problem is now, that the BitmapData.draw()-method, with which I generate and refresh the "screenshots", captures the gradient blend-shapes as normal shapes i.e. black stripes instead of alpha-masks. Has anyone an idea how to avoid this?

Thanks and regards,
Lukas

Write Visible Part Of Masked Image To Bitmapdata?
the idea is - a dynamically loaded image is loaded into a movieclip and masked so that just a small area of the entire thing is visible... is there a way to copy that visible area into another movieclip? can it be done with bitmapdata?

-|-Masked-|-drawing-|-line-|-
Hi.. This is a draw-code, that makes so u can draw lines..
I want to draw in an area, and outside the area I don't can draw.
I need help to do this.

ActionScript Code:
var thickness = 1;  //Thickness of line
var lcolour = "0x000000";  //Colour of line
var scolour = "0x999999"; //Colour of fill
var linjealpha = 100;  //Transparency of the linje
var mDown = false;
var startx, starty, endx, endy;
//Gets the starting point when mouse is clicked
this.paper1.onMouseDown = function() {
      var id:Number = _root.getNextHighestDepth()
      linje = _root.createEmptyMovieClip("linje_" + id, id)
      mDown = true;
     startx = _xmouse;
     starty = _ymouse;
};
//When mouse is released stop drawing linje
this.paper1.onMouseUp = function() {
       mDown = false;
};
//Do all the commands
this.onEnterFrame = function() {
   //Get the mouse coordinates
   endx = _xmouse;
   endy = _ymouse;
   //Destroy current linje to prepare for new one
   
   //Draw the linje if mouse is down
   if (mDown) { 
      linje.clear();
      linje.lineStyle(thickness, lcolour, linjealpha);
      linje.moveTo(startx, starty);
      linje.lineTo(endx, endy);
   }
};
stop();

AS3 - BitmapData Drawing OnEnterFrame Slows System Down
Hi - I'm migrating some code from AS2 to AS3 that renders bitmap data on an onEnterFrame event... but while it works great in AS2, it REALLY boggs down the system quickly in AS3... here's a snippet of the code... hope someone can help:


Code:
var stampImage:BitmapData = new BitmapData(myElement.width, myElement.height, true, 0xFFFFFF);

addEventListener(Event.ENTER_FRAME, enterFrameEvent);

function enterFrameEvent(e:Event) {
stampImage = null;

var stampImage:BitmapData = new BitmapData(myElement.width, myElement.height, true, 0xFFFFFF);
stampImage.draw(myElement, new Matrix(1, 0, 0, 1, myElement.width/2, myElement.height));
stampImage.draw(myElement, new Matrix(-1, 0, 0, -1, myElement.width/2, myElement.height));
stampImage.draw(myElement, new Matrix(.5, 0, 0, .5, myElement.width/2, myElement.height));
}

Masked Video Component Issues.
Hey Guys,

I am trying get a video component working with a mask, the mask is not complex at all. I have the component working fine. But when I mask the video all the buttons don't work. I have tried to make the mask a clip and mask.mouseEnabled = false; but that did not work.

Thanks..

Irritating Masked Video Personalities
Is anyone else getting really sick of visiting a web sites and constantly being confronted with a person walking across the screen yapping at you about their site or product? Does anyone else immediately hit backspace button?

Just wondering.

Masked Video Component Issues.
Hey Guys,

I am trying get a video component working with a mask, the mask is not complex at all. I have the component working fine. But when I mask the video all the buttons don't work. I have tried to make the mask a clip and mask.mouseEnabled = false; but that did not work. Adding the mask to video kills all the component buttons, when I remove the mask the component works perfectly.

Thanks..

BitmapData Video Security Problem
I am using BitmapData to access pixels of an FLVPlayback instance (playing over http). The video is hardcoded to http://www.frontenddeveloper.net/Content/intro.flv. The crossdomain.xml file is wide open ("*") at the root.

Here's the problem. If you access the page using the www prefix, it works great: http://www.frontenddeveloper.net/wik...ver_With_Video but if you access it minus the www the audio plays but the video doesn't: http://frontenddeveloper.net/wiki/in...ver_With_Video

Go there and you'll see an american flag waving until the video starts, or you'll hear the video but still see the flag.

I'm pretty sure I know WHAT's going on... the absence of the www makes Flash think the video is on a different subdomain, and is blocking pixel-level access. But since crossdomain.xml is already set to the "* pimp me out" level, I'm at something of a loss as to what I can do to fix it.

Any suggestions?

Drawing On Top Of Video...
I donr have any .FLA's i can share right now, but I'm working on this application where a video is loaded from a database or xml file. The video plays in real time or slow motion (if possible), and allows the person to draw on top of the video using the drawing api. The drawing is somehow recorded on the same timeline and framerate as the movie, then saved and added to the database for playback later, on top of the same movie.

I thought about using some type of meta-data that follows the video around, but im not sure how that would work. I've done some things, like recording the drawing into an array, i know how to do that.

Maybe someone can help out with this? Or lead me in the right direction... My biggest problem is being able to synchronize the drawing playback (from the array) with the movie as its playing.

Also need to figure out how to play video in slowmotion if possible.

In the past i've been stuck with the usability factor, the user not being able to upload the video in .mov or .avi format. but i've since given up on that, i'll try to do that last if i have time.

Drawing A Video Problem
gooday all
im studying a technique of reconizing color of a live webcam
here is my code below:
--------------------------------------------
import flash.display.BitmapData;

myCam = Camera.get();
myVideo.attachVideo(myCam);
//
this.createEmptyMovieClip("hihi", this.getNextHighestDepth());
myBit = new BitmapData(myVideo._width, myVideo._height, false);
myBit.draw(myVideo);
hihi.attachBitmap(myBit, this.getNextHighestDepth());
--------------------------------------------
the problem is
"hihi" didn't attach a video image but a rectangle with preset color

whould kindy anyone can tell me how to solve the problem?
should i need to apply a filter?

Drawing Over Live Video
Hi I am trting to create an application in which i need to do a free hand drawing over live video with the mouse pointer . then i need to grab the x,y co-ordinates
and trasnfer them in a udp packet. Is this possible in flash or using VB. any help would be really appreciated.
I dont have to trasnfer the video .

Drawing Over Live Video?
Hi I am trting to create an application in which i need to do a free hand drawing over live video with the mouse pointer . then i need to grab the x,y co-ordinates
and trasnfer them in a udp packet. Is this possible in flash or using VB. any help would be really appreciated.
I dont have to trasnfer the video .

Drawing Over Live Video
Hi I am trting to create an application in which i need to do a free hand drawing over live video with the mouse pointer . then i need to grab the x,y co-ordinates
and trasnfer them in a udp packet. Is this possible in flash or using VB. any help would be really appreciated.
I dont have to trasnfer the video .

BitmapData::draw(BitmapData) Doesn't Seem To Support Alpha Channels
Hi all,

I have a BitmapData object with alpha channels, bm1, and would like to draw it into another BitmapData object, bm2. While I can draw bm1 into bm2, alpha channels do not seem to work. Here is some code to illustrate what I'm trying to do:

// create an all-green but semi-transparent BitmapData object (all alphas are set to 0x80 in the constructor)
var bm1:BitmapData = new BitmapData(100, 100, true, 0x8000FF00);

// create an all-white BitmapData object and display it
var bm2:BitmapData = new BitmapData(100, 100, true);
addChild(new Bitmap(bm2));

// draw bm1 into bm2 in the onTimer() callback function
bm2.draw(bm1);

I would expect bm2 to be light-green, because it's semi-transparent, but it's 100% green, i.e., 0xFF00FF00.

I already tried all blend modes, but blend modes didn't make a difference.

Any ideas?

Btw, what I'm trying to do is to extract an arbitrary collection of pixels (as opposed to a rectangle) from a bitmap (bm1) by copying it into another bitmap (bm2) and using alphas of 0x00 and 0xff to select the pixels to be extracted. Is there a better way to do this? (or any way for that matter? ;-)

Thanks!


-Bernd

Drawing Over Live Flash Video
In a short description I need to manipulate Flash video LIVE and NOT manipulating it using Flash software. Main gold is to play video and in the same time I need for example to draw something over this video using mouse. Like I am showing some pointers to the public. And this actions/drawing I performed should be poddible to RECORD because there will be option to record this presentation I made. After that if shouled be able to manipulate this video in some other way .
I researched through internet but I could not find any tutorial which can provide me with guidance in this direction I need, so if someone can point me to anything I would be very grateful.

thanks

Convert A Video Object To A Bitmapdata Object
package {
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.*;
import flash.media.Camera;
import flash.media.Video;
import flash.display.BitmapData;
import flash.display.MovieClip;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.events.Event;



public class CameraExample extends Sprite {

private var video:Video;
private var _bitmapData:BitmapData;
private var _bitmapDataDue:BitmapData;
private var mybitmap:BitmapData;

public function CameraExample() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;

var camera:Camera = Camera.getCamera();

if (camera != null) {
camera.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
video = new Video(camera.width * 2, camera.height * 2);
video.attachCamera(camera);

addChild(video);

_bitmapData = new BitmapData(video.width , video.height, false);

_bitmapData.draw(video);

var _bitmapDataDisplay:Bitmap = new Bitmap(_bitmapData);
_bitmapDataDisplay.x= camera.width * 2;

addChild(_bitmapDataDisplay);


}

what's wrong with this?

thank yooou

Drawing An Outline Of An Object In Flash And Then Animating The Drawing?
I wish to draw an outline of an object in flash? bit by bit a piece of the outline is drawn until the outline is completed, once this has finished then object then appears and the outline disppears (this part I can manage).

I do not know where to begin? So may need a lot of direction on this one.

Scrolling Drawing Board? Drawing Without Moving The Mouse
Hello, I'm new to this board and kind of a flash newbie so you could probably help me out.


What I'm trying to build is what you could call a scrolling drawing board - just like a drawing board but when the mouse comes close to the edge of the window, it scrolls and lets you continue your drawing.
I have no problem creating a drawing board with API, but i can't make it scroll. Usually when i want to scroll a background image i make it move along with the mouse when the cursor is near the edge of the window (for example, if the mouse's coordinates are above a certain number, the background image starts moving in one direction so it "scrolls" in the other direction).
So i wanted to do this with the movieclip of the drawing in a drawing board (make it move according to mouse's coordinates near the edge of the window), but when i scroll i have to stop the mouse at the edge of the window because i cant go any further :p so the drawing moves but it stops drawing. Or maybe what i need is some way to draw even when the mouse is not moving. Is that possible?

I'm sorry it may seem a bit confused (moreover english isnt my native langage :p), I'll try to post an example later. In the meantime, if any of you see how i can do that ... thanks

Drawing Board With Specific Section For Drawing
Ive made myself a drawing board in flash, but the problem is that i can draw over anything on the stage and I want to have a specific canvas for drawing.
I tried creating a separate MC and pasting the code there but it didnt help although i have no idea why. Any ideas?

Drawing With A Wacom In Flash V Hand Drawing
Animations like American Dad, Family Guy, Futurama, The Simpsons, are they hand drawn frame by frame, or are they more likely to be wacom drawn straight into Flash?

Drawing Scripts For A Drawing Program
Need help with reference scripts for a simple drawing program. I'd like the user to be able to select different tools (circle, square, pencil, paint brush), change the color of the fill, and erase or reset the screen. Can anyone refer me to the right place?

Drawing A Soft Mask... Drawing Api?
Hello everyone, (almost) first post here
I'm creating a, quite original flash website (meh... not my idea in fact, I'm only the flasher!), in wich you're in a car, sitting on the passenger side, and you're looking outside to see the contents coming on the road.
It rains.
A lot.
So the windowseat is "fogged" (how can I say that...???) and while you're loading the content you actually can draw on the glass with your.. err... finger (mouse!), like how your friends usually do in your car when you really don't want their fingerprints all over your car glass

Ok, easy way to do that:
1 - attachmovie
you actually duplicate a circle, give it some randomness in blurring and size so it looks irregular and place it right under your mouse.

Good, it works... but when you move fast, it just leaves a blank spaces between clip and clip...

Hey... that's not fair...

2 - drawing api
Oh my god... I can't make a mask with a simple line, so I should draw a shape while moving the mouse.
The point is... HOW???

I dunno if there's a better way to do that, but that's the only one in my mind now.
Actually the drawn clip should also be blurred a little bit (1 or 2 percent) wich is not a problem since you can easily blur the container.

But now the real point is: how do I draw like that with the beginfill?!?!?

Note: I uploaded the fla so you can have an idea on how it looks...

Help Needed In AS3 Drawing Board ( With Drawing Api)
Hi all,
I'm doing a flash application with flash cs3 actionscript3. I tried with as2.
Now I am facing difficulty in doing it in AS3.

the application includes:-
all the vector or images should be editable means scale rotate color change etc.

draw line -
draw rectangle -
circle
input text.
curve with node points

if anyone have any tutorials or any resourse please post here.

thanks inadvance
Harish

Masked
Any reasons when I create a mask atop a button the mask does not work when I publish/test?

I have created the masked layer in the normal over and up states... none work?

thx

Masked Or Bug?
When you play this in the tester or the player it works but if you play it in a web page you can not view the photos but you can see the controller. Please shine the light on me a little bit.

Borthar.

[MX04] "Drawing" Line Effect Using Drawing API
So i've got a basic drawing using the drawing API ala:
myLine = this.createEmptyMovieClip("newLine", 1);
myLine.lineStyle(3, 0x000000, 100);
myLine.moveTo(0,0);
myLine.lineTo(100,0);
myLine.lineTo(100,100);...etc

Now is there a way to have flash animate the drawing of the lines like a map from an Indiana Jones movie?

Thanks!

Masked Menus HELP
i have a bunch of buttons in a masked drop down menu that i made in flash ... everything is flash ... um my question is when i click on these buttons that i grouped with this tween that drops down it is playing the tween again and not doing what it is suppost to do. i click the object button and added an action "On Mouse Event" + "GOTOandPLAY" and the scene which i want to be played.... UGG im in dire straights SOMEONE PLZ HLEP .. i have a deadline lol

Masked Unmovable?
okay, i have three ... oh man, don't know the english expression... you know, basich thing in the timeline, not frames, but the ones on top of each other. levels?
well, i have three of them, one contain the actionscripts, one wwith is a mask and the one underneath is masked, containing objects.
it works fine, but...
i'm trying to move the object that is the mask (with acionscript), and it works, as long as it's not defined as a mask. but if it is, it won't move no more.


but why?


gracias, marc

Dragging A Masked MC...
I'm fairly new to Flash 5 and guess what? I'm having a problem. I'm trying to use masking to have the image of a spider web with a bar of light across it. Easy to do, I know, but I also want this MC (the bar of light) to follow the mouse up and down on the screen. I can get the bar of light to work with masking, or the MC up and down motion to work, but I can't seem to get the two to work simultaneously. Someone please help me....

Masked Textfield ?
Hi everyone
Is there any way to make a textfield show when placed behind a mask ?
I doubt about it, make me wrong

jolan

Help.....masked Text
hi all..
i made a easemenu navigating system...inserted output text(abc.txt)
all the parts of menu...because of the menu is masked i cant see the the text but it can be still selectable with mouse ...i ve tried layers,loadmovie but i cant getrid of it ....plese some help!

Help With Masked Preloader
Hi there!

Iīm creating a preload bar,modifying the preloader by ianlabs from this site (only for practice,of course...)

But I have a problem.In the movie clip "load bar" I created a new layer above the bar,added some text like "loading..." and used it as a mask for the bar animation.If I press enter to see the animation,the mask works fine,but when I press Ctrl+Enter*2 to see how it works on an 56K modem,the mask doesnīt work properly and the bar increases but itīs not masked. It worked only one time later,but I canīt do it to work again because I canīt remember what I did with the mask (and I didnīt save it...what a dumb...)

Can you help me? please???????? I beg you!!!...

Masked With Following The Mouse
he masked with radial effect gradient
following the mouse, can that it?

some tutorial

How To Control A Masked Mc?
Hello...is it possible to stop a masked mc that is loaded into main movie?

I have my main movie that loads a swf into an empty mc on stage. In the loaded swf, I have a masked mc playing in the background. Is it possible to stop the masked mc by pressing buttons on my main movie?

Masked Loading Bar?
All I need to finish this site I'm working on is a loading bar.

All I need it to do is fill in the word "LOADING" and have a percentage.

I would think that all you would have to do it make a normal loading bar, and then just put a mask on top of it saying the word "LOADING"

I've tryed it and its failed a couple times!

Somebody PLEASE help me out here? I need this by friday!

Masked Loading Bar?
All I need to finish this site I'm working on is a loading bar.

All I need it to do is fill in the word "LOADING" and have a percentage.

I would think that all you would have to do it make a normal loading bar, and then just put a mask on top of it saying the word "LOADING"

I've tryed it and its failed a couple times!

Somebody PLEASE help me out here? I need this by friday.

Popup - Masked Url
Ok here is my situation.

Confusing break down:
Designing a new theme for a CMS called xoops, Ive desided to do a flash header. Within the header is a button that pops up a html with a flash mp3 player. Now, all has gone well in the design and the coding untill I ran into a slight but very frusterating problem. The sites url is masked, therefor amongst frames and not executing the script

Simple break down:
Here is the site using a direct link->

http://kittin.dynu.com/index.php

And here we have the site using the masked url->

http://t-tech.org/index.php

Note: Little blue button in the header is to activate the java script pop up :P

Now, as you can see directly linked the script runs fine and the pop up loads, however while masked we get nothing

Help a girl out please, im very frusterated with this one

PopUp - Masked Url
Im hopeful that I can get an answer in this forum, I have posted in the "Flash MX" forum for 2 days now and still no response.

Ok here is my situation.

Confusing break down:
Designing a new theme for a CMS called xoops, Ive desided to do a flash header. Within the header is a button that pops up a html with a flash mp3 player. Now, all has gone well in the design and the coding untill I ran into a slight but very frusterating problem. The sites url is masked, therefor amongst frames and not executing the script

Simple break down:
Here is the site using a direct link->

http://kittin.dynu.com/index.php

And here we have the site using the masked url->

http://t-tech.org/index.php

Note: Little blue button in the header is to activate the java script pop up :P

Now, as you can see directly linked the script runs fine and the pop up loads, however while masked we get nothing

Help a girl out please, im very frusterated with this one

Masked XML Text
Greetings all,

I recently added a small XML news box component to a site i'm working on, the problem is, the component is on a layer that is masked, and when I play the swf all I see is an empty box. I know the content is loading, but for some reason the mask is blocking it. Any ideas on a remedy would be greatly appreciated. I have enclosed a copy of said component (NewsBlock).

Keep it close to the soul.

-Mike

Masked Text
I tried using a magnified text trick using a tutorial I had found. I cannot get it to show the masked text. The un-magnified text shows up fine but the larger masked text doesn't show up at all. I have attached the .fla hopefully someone can tell me what I am doing wrong. BTW I am using Flash MX Pro 2004. Thanks

Components Masked
Hi
when masking text you have to, for some reason, embed the fonts or else they will not show up on screen..I hate that..

I have the same problem with at listbox component.. when testing the listbox has no text and you cannot click it..

Does anyone know what should be done before this works?

Masked Buttons
hi out there,

i have a series of 6 jpgs which each have a mask & then are placed in a buttons.

is this an ok thing to do - as the masks don't work & are moved i've debugged but can't find any reason for it to happen.

surely this is a realy simple thing?

Masked Text
Hi!

I have a dynamic text (more correctly, an imported .swf with text, but I need a mask for the target mc. The text disappears. This has happened many times before... Does anybody know about a solution?

thanks

Some Children Not Being Masked
I have a Sprite containing several DisplayObjects. All of the various Bitmaps and Sprites contained within are masked just fine. But I have several TextFields that are ignoring transparency, and are being masked by the bounds of the mask object.

My mask is a rounded rectangle Shape (the text is being masked as if it were a regular rectangle fill).

I have already encountered several instances, where incorrect order of my code has caused problems. If I declared everything about a TextField, and then set 'text.defaultTextFormat = format' last, none of the TextFormats were applied. But simply moving that line towards the beginning of my TextField declarations fixed the problem.

Is this a similar case? How can a TextField ignore the mask that every other child is following just fine? Where should I look for problems? Are there certain procedures which must be followed, and how would you break those?

Thanks in advance.

[CS3] Items Not Being Masked
Hi There,

I was hoping someone could look at this script and tell me why the items are not being masked.
I'm using t.setMask(tm) where t is the item I'm loading images into and tm is the mask. I'm duplicating it because I need one mask per item but none of them are being masked. Have I done something stupidly wrong?


PHP Code:




var cm = content.sectioncontent5.attachMovie("clientsmasker","clientsmasker",1001);
cm._x = 0;
cm._y = 30;

xml.onLoad = function()
{
    var nodes = this.firstChild.childNodes;
    numOfItems = nodes.length;

    for (var i=0; i<numOfItems; i++)
    {
        var t = content.sectioncontent5.attachMovie("item","item"+i,i);
        var tm = cm.duplicateMovieClip("clientsmasker" + i,i+1);
        t.setMask(tm);
        }
}







Many thanks
matt

Raindrops Masked
Yes, rain has been covered ad nauseum on these boards. and I've read the posts, trying to achieve what I'm after, but most of the applications that were previously covered didn't seem to apply.

Here's the goal:

Raindrops wash away the old image to reveal the new one.

I initially tried masking, but as each raindrop overlapped, it created a hole in the mask instead of overlapping.

So, NOW, my solution is to create a new movieclip for each raindrop, and that new MC includes an instance of the image. Very very bulky with the memory I think. I'm sure there's a better solution. I read about setMask but never could figure out how to use it right, and since I'm placing each raindrop at random, (and THEN placing another MC of the grey ripple on top of everything else) I don't know if the setMask will work unless I can move that mask around.

And hey!! Attaching the zipped file.

DuplicateMovieClips Is Not Getting Masked
Can anyone help me out with this, please?

I am duplicating some set of movieclips which should go behind the bar but the mask is not getting set. I have attached the movie.

Please check and let me know where I am doing wrong.

Thanks,
FL

Masked Layer
Hello everyone ! i'm new here and beginner in flash !

My probleme is i have a external mc loading in the blank mc that is masked, my probleme is when i change section my masked mc restart the external mc loaded in the masked mc !!

I don't know why and getting frustated about this !!

Copyright Đ 2005-08 www.BigResource.com, All rights reserved