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




Loading An Image Into A MovieClip, Then Into BitmapData [renamed]



Hello, I am trying to load an image into a movieclip and then draw the contents of the movieclip to a bitmapData object. Below is some sample code.
Code:
target.jpg_mc.loadMovie(url); target.createEmptyMovieClip("loader_mc", 100); target.loader_mc.bmc = target.jpg_mc; // movieclip where to load original image target.loader_mc.tmc = target.bmp_mc; // movieclip with smoothed image target.loader_mc.onEnterFrame = function(){ bl = this.bmc.getBytesLoaded(); bt = this.bmc.getBytesTotal(); if (bl >= bt && bt > 4 && this.bmc._width > 0 && this.bmc._height > 0){ //target._parent._visible = true; this.bmc._visible = false; var bitmap = new BitmapData(this.bmc._width, this.bmc._height, true); this.tmc.attachBitmap(bitmap, 100,"auto", true); bitmap.draw(this.bmc); Stage.addListener(target); target.gotoAndPlay("in"); this.removeMovieClip(); } }
For some reason it always draws a white box rather than the image. Has anyone ever seen this happen with the bitmapData class? Thanks for any help! Wade



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 11-06-2006, 04:13 PM


View Complete Forum Thread with Replies

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

[fmx] Problems With Loading Into A MovieClip Via A String [renamed]
Alright, I know this is a mess, please forgive me.
I'm trying to get it to load into one of the movies that its creating but it doesn't seem to like the string, if I manually enter _root.holder_mc.mc_0 it works fine.

Any ideas?


Code:
#include "com.qlod.LoaderClass.as"
var depth = 0;
var myLoader = new com.qlod.LoaderClass();
var picPath = "";
var pics = ['winterrangep1.jpg',
'winterrangep2.jpg',
'winterrangep3.jpg',
'winterrangep4.jpg',
'winterrangep5.jpg',
'winterrangep6.jpg'];
var picText = [''];
var picCount = _root.pics.length - 1;
var objIndex= 0;
var nextX = 265.4;
var nextY = 293.9;
var prevX = 0;
var prevY = 297.4;
MovieClip.prototype.loadObj = function (file, i) {
if (file.length) {
trace(i);
objWhereToLoad = "_root.holder_mc.mc_"+i;
objWhereToLoad = objWhereToLoad.toString();
trace(objWhereToLoad);
myLoader.load(objWhereToLoad, file);
var mc_loader = _root.attachMovie("loader", "mc_loader", 4);
mc_loader._x = nextX-mc_loader._width/2;
mc_loader._y = nextY;
mc_loader.loadBar.onLoadProgress = function(loaderObj) {
this._xscale = loaderObj.getPercent();
trace(this + ' Progress: ' + loaderObj.getPercent());
};
mc_loader.loadBar.onLoadComplete = function(success, loaderObj) {
removeMovieClip(mc_loader);
current_index++;
load****();
trace(this + ' Complete');
};
myLoader.addListener(mc_loader.loadBar);
} else {
trace(this + ' No Image to Load');
}
};
var holder_mc = _root.createEmptyMovieClip("holder_mc", _root.depth++);
current_index = 0;
load**** = function () {
//var mc = loadMovie(""+pics[current_index]+"", holder_mc["mc_"+current_index]);
loadObj(pics[current_index], current_index);
if (last_index == current_index) {
break;
}
var last_index = current_index;
};
load****();
for (i=0; i<pics.length; i++) {
holder_mc.createEmptyMovieClip("mc_"+i+"", depth++);
}

[fmx] Problems With Loading Into A MovieClip Via A String [renamed]
Alright, I know this is a mess, please forgive me.
I'm trying to get it to load into one of the movies that its creating but it doesn't seem to like the string, if I manually enter _root.holder_mc.mc_0 it works fine.

Any ideas?


Code:
#include "com.qlod.LoaderClass.as"
var depth = 0;
var myLoader = new com.qlod.LoaderClass();
var picPath = "";
var pics = ['winterrangep1.jpg',
'winterrangep2.jpg',
'winterrangep3.jpg',
'winterrangep4.jpg',
'winterrangep5.jpg',
'winterrangep6.jpg'];
var picText = [''];
var picCount = _root.pics.length - 1;
var objIndex= 0;
var nextX = 265.4;
var nextY = 293.9;
var prevX = 0;
var prevY = 297.4;
MovieClip.prototype.loadObj = function (file, i) {
if (file.length) {
trace(i);
objWhereToLoad = "_root.holder_mc.mc_"+i;
objWhereToLoad = objWhereToLoad.toString();
trace(objWhereToLoad);
myLoader.load(objWhereToLoad, file);
var mc_loader = _root.attachMovie("loader", "mc_loader", 4);
mc_loader._x = nextX-mc_loader._width/2;
mc_loader._y = nextY;
mc_loader.loadBar.onLoadProgress = function(loaderObj) {
this._xscale = loaderObj.getPercent();
trace(this + ' Progress: ' + loaderObj.getPercent());
};
mc_loader.loadBar.onLoadComplete = function(success, loaderObj) {
removeMovieClip(mc_loader);
current_index++;
load****();
trace(this + ' Complete');
};
myLoader.addListener(mc_loader.loadBar);
} else {
trace(this + ' No Image to Load');
}
};
var holder_mc = _root.createEmptyMovieClip("holder_mc", _root.depth++);
current_index = 0;
load**** = function () {
//var mc = loadMovie(""+pics[current_index]+"", holder_mc["mc_"+current_index]);
loadObj(pics[current_index], current_index);
if (last_index == current_index) {
break;
}
var last_index = current_index;
};
load****();
for (i=0; i<pics.length; i++) {
holder_mc.createEmptyMovieClip("mc_"+i+"", depth++);
}

Loading Image Into Bitmapdata
Hi

I am loading bitmapdata from the library like this

linkageId = "landscape";
myBitmapData = BitmapData.loadBitmap(linkageId);

Than attach this bitmap image to a movie.

mc = this.createEmptyMovieClip("mc", 0);
mc.attachBitmap(myBitmapData, 0);

Can someone give me the code to load my image using loadMovie instead of from libarary and attach it to movie clip mc.

Loading Image Into Bitmapdata
Hi

I am loading bitmapdata from the library like this

linkageId = "landscape";
myBitmapData = BitmapData.loadBitmap(linkageId);

Than attach this bitmap image to a movie.

mc = this.createEmptyMovieClip("mc", 0);
mc.attachBitmap(myBitmapData, 0);

Can someone give me the code to load my image using loadMovie instead of from libarary and attach it to movie clip mc.

Loading Image Into Bitmapdata Using Loadmovie
Hi

I am loading bitmapdata from the library like this

linkageId = "landscape";
myBitmapData = BitmapData.loadBitmap(linkageId);

Than attach this bitmap image to a movie.

mc = this.createEmptyMovieClip("mc", 0);
mc.attachBitmap(myBitmapData, 0);

Can someone give me the code to load my image using loadMovie instead of from libarary and attach it to movie clip mc.

Dynamically Load An Image-Either The Image Resizes Or The Movieclip It's Loading To?
I will make a frame movie instance 400 X 400px called frame_mv.

I will use the script:
loadMovie("pic1.jpg", frame_mv);

If the pics being loaded were of different sizes. eg pic1.jpg was 1600 X 800

1- How would I make the pic resize to 400 X 400 or 400 X 200 so that it fits the frame_mv.
2- How would I make the frame_mv change size according to the pic dimensions being loaded?

[F8]copy BitMapData To Duplicate Image = Blurred Image?
I'm making a basic image gallery. I'm reading data about the files from xml which then creates thumbnails. I use the loadMovieClip class to load the images into the thumbnails (I'm loading the full size images but then reducing the size of them to look like thumbnails).

I have figured out how to use the BitMapData class to copy the images into cache so when you click on a thumbnail, it instantly appears, but the resulting larger image has pretty low quality. Is this a result of copying the BitMapData?

Also, I saw on another post that if you load an image once, it will be in your browser's cache so you wouldn't have to download it again. I'm wondering how well that works.

Also, GPARIS, if you read this, what method do you use on your site http://www.genevieveparis.com/client...iemacleod.html ?

I noticed it loads thuimbnail images up but the large images are instantly available and they are sharp/high quality. I thought I read in a post somewhere that you use the bitmap method, but couldn't find the post. If that's the case, is there something you do to make sure the bitmap data comes out sharp after copying? Awesome site by the way.

Thanks for any input.

Loading Image Into Movieclip Variable?
I have this class:

class cUser {
public var ImgUrl:String = "test.gif";
public var MCImg:MovieClip;

public function cUser()
{
this.MCImg = new MovieClip();
}

public function LoadImage()
{
this.MCImg.loadMovie(this.ImgUrl);
_root.mctest = this.MCImg;
}
}

I want to load the image into that variable and then display it on the scene in _root.mctest. Can I do this? What am I doing wrong. I am getting this error:

Target not found: Target="undefined" Base="_level0" at this.MCImg.loadMovie(this.ImgUrl);

When I try to do this I don't get any errors but the movieclip on the scene does not change to this.ImgUrl:
_root.mctest.MCImg.loadMovie(this.ImgUrl);

Thankful for help!

Error Loading Image Into Movieclip From Xml
Hi, I am creating an image gallery and am trying it to display images from the internet, I have created the xml that has the URLs of the images in. They are images on my own website (well piggybacking off a website created by a friend), but they won't load, I get this error in the output.


Quote:




*** Security Sandbox Violation ***
Connection to file:///C|/Documents%20and%20Settings/Owner/Desktop/Design/Flash/undefined halted - not permitted from http://www.mpagbyorksregion.co.uk/to...acourtlogo.jpg
-- Remote SWFs may not access local files.




This error only occurs when I try and get another image. I will explain, when the swf loads, the code tells it to get the first image from the xml and this displays fine, but I then created a button that onRelease it changes the movie clip's image to another one, this is when I get the above error.

Any suggestions?

Thanks.

Loading Image Dynamically To One Movieclip -one Below The Other
Hi,

how to Load image dynamically to one movieclip -one below the other.

I have to show 5 images one below the other in one empty movieclip

Please help me with this.


Thanks

Loading Single Image To Movieclip From Xml
Hi, I use this code to load data from a xml file and it works fine but I now need to add an image and I can´t figure out how. Please help!!



var myTextLoader:URLLoader = new URLLoader();
var xml:XML;

myTextLoader.addEventListener(Event.COMPLETE, onLoaded);

function onLoaded(e:Event):void {

xml = new XML(e.target.data);
var il:XMLList = xml.item;


comments.text = (il.comments);
addChild(comments);

epost.text = (il.epost);
addChild(epost);

site.text = (il.site);
addChild(site);

navn.text = (il.name);
addChild(navn);

myTextLoader.load(new URLRequest("http://www.osloimpro.no/medlem_gunnar.php"));

}

Thanks

Loading An Image From The HD And Displaying It In A MovieClip
ActionScript Code:
graphicAnswerCONTAINER_mc.visible = true;
trace (graphicFilePath[theNum]); // C:/test/images/graphic.gif
var myRequest:URLRequest = new URLRequest( graphicFilePath[theNum] );
var loader:Loader = new Loader();
loader.load( myRequest );

graphicAnswerCONTAINER_mc.addChild(myRequest);

Trying to load a graphic into a MovieClip that's on my stage.

Receiving this error before the file publishes:
1067: Implicit coercion of a value of type flash.net:URLRequest to an unrelated type flash.display:DisplayObject.


If I do this:

ActionScript Code:
graphicAnswerCONTAINER_mc.visible = true;
trace (graphicFilePath[theNum]); // C:/test/images/graphic.gif
var myRequest:URLRequest = new URLRequest( graphicFilePath[theNum] );
var loader:Loader = new Loader();
loader.load( myRequest );

graphicAnswerCONTAINER_mc.addChild(loader.content); // loader.content

It will publish, but when I come to this part of the code, it throws this error:
Error #2007: Parameter child must be non-null at flash.display::DisplayObjectContainer/addChild()


All suggestions and/or corrections are welcome.

Loading An External Image Into A Movieclip.
I may be missing something painfully obvious here but I cannot seem to find it.

Basically I want to pull in an external image, place in in a movieclip on my stage and have it actionable, as in have that movieclip performs actions for example be moveable around the stage by the user. However when I load in an image onto the mc it becomes static, almost part of the background, regardless or what actions are set on the mc.

Can anyone help here please?

Movieclip Loading Image On X And Y Grids
I am creating an MC for each image I have in a folder. I create an empty MC then I load the image in the MC. the problem is when I create an 2 MCs with the same '_x' value, the older MC becomes invisible and the new MC becomes visible.

here is my code anyway...

var i = 4;
var y = 50;

do {
i++;
var x = x + 90;
_root.createEmptyMovieClip("clip"+i,x);
_root["clip"+i].createEmptyMovieClip("imageHolder_mc", this.getNextHighestDepth());
if (x >= 900) {
x = 90;
y = y + 60;
}
trace(x);
_root["clip"+i]._x = x ;
_root["clip"+i]._y = y ;
_root["clip"+i]._xscale = 3;
_root["clip"+i]._yscale = 3;
_root["clip"+i].imageHolder_mc.loadMovie("image"+i+".jpg");

_root["clip"+i].onRollOver = function() {
trace("hello world");
}

function mytime(){
trace("hello");
}
timer = setInterval(mytime,1000);


} while (i<15);


Any ideas.

thanks in advance

Loading Simple Image To Movieclip With Xml
Okay I have searched the forum for loading an simple image into flash using xml, and some have not been answered.
I simply got a jpg image and want to load it in a movie clip called (pic)

ActionScript code:>>>

Code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
}
loadImage();
} else {
trace("file not loaded!");
}
}
//Load Image
function loadImage() {
if (loaded == filesize) {
pic._alpha = 0;
pic.loadMovie(image[0], 1);
}
}
//Load your xml file to be showed up
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.load("images.xml");
<<<

and xml code file images.xml

Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image>50.jpg</image>
</pic>
</images>

Loading An External Image Into A Movieclip.
I may be missing something painfully obvious here but I cannot seem to find it.

Basically I want to pull in an external image, place in in a movieclip on my stage and have it actionable, as in have that movieclip performs actions for example be moveable around the stage by the user. However when I load in an image onto the mc it becomes static, almost part of the background, regardless or what actions are set on the mc.

Can anyone help here please?

Loading Image Into Movieclip Variable?
I have this class:

class cUser {
    public var ImgUrl:String = "test.gif";
    public var MCImg:MovieClip;
    
    public function cUser()
        {
        this.MCImg = new MovieClip();
    }
    
    public function LoadImage()
    {
        this.MCImg.loadMovie(this.ImgUrl);
        _root.mctest = this.MCImg;
    }
}

I want to load the image into that variable and then display it on the scene in _root.mctest. Can I do this? What am I doing wrong. I am getting this error:

Target not found: Target="undefined" Base="_level0" at this.MCImg.loadMovie(this.ImgUrl);

When I try to do this I don't get any errors but the movieclip on the scene does not change to this.ImgUrl:
_root.mctest.MCImg.loadMovie(this.ImgUrl);

Thankful for help!


--- neteject.com - Internet Solutions ---

LoadVars Not Loading Image Into Movieclip
Last edited by scott37 : 2005-10-11 at 18:49.
























my bad - figured it out...

GetBytesLoaded Loading Image Into Dynamic MovieClip
Hi,

I'm creating a movieClip dynamically and loading an image into it. This works fine, although I'd like to monitor the loading of the image but whenever I try "getBytesLoaded" or "getBytesTotal" it returns the value "0". This is an excerpt of my code:


code:
this.main_mc.createEmptyMovieClip("imgClip",5);
this.main_mc["imgClip"].loadMovie("pic.jpg");
this.main_mc["imgClip"].onEnterFrame = function() {
trace(this.getBytesLoaded());
}


If anyone has any ideas about this, I would really appreciate any help.

Thanks!

Loading Image To Movieclip - Security Settings?
Hi,

I'm loading jpg to videoclip and it works on Flash IDE preview, but not in published .swf (IE)(It doesnt load images)

How to make it work?

I have tried adding
System.security.allowInsecureDomain("*");
System.security.allowDomain("*");
But no difference..

*edit: I'm viewing the published swf in network drive, the images would be loaded from intranet http, is that a problem?

Dynamic Movieclip Not Loading External Image?
Hope someone here can help me! :lol:

I made a post in the Flash - Actionscript forums over at Adobe and thus far have not got a reply...

I'm making a little map with marked points.... the map image loads in "zone_mc" but the currGatherable does not seem to load or at least does not show up, loading to "Gatherable_mc"...

Where did I go wrong?

See the below code for refference...

Code:

function GenerateMap(map_xml) {
   var a_zone = map_xml.firstChild.childNodes;
   for (var i = 0; i<a_zone.length; i++) {
      var a_zone = a_zone[i];
      _root.createEmptyMovieClip("zone_mc", 20);
      _root.zone_mc.loadMovie(a_zone.attributes.image);
      //load the map
      var Gatherable = a_zone.childNodes;
      //try to load the Gatherable items
      for (var g = 0; g<Gatherable.length; g++) {
         currGatherable = Gatherable[g];
         _root.zone_mc.createEmptyMovieClip("Gatherable_mc", 10);
         _root.zone_mc.Gatherable_mc.loadMovie(currGatherable.attributes.Icon);
         _root.zone_mc.Gatherable_mc._height = 16;
         _root.zone_mc.Gatherable_mc._width = 16;
         _root.zone_mc.Gatherable_mc._x = currGatherable.attributes.XPos;
         //set the gatherable X
         _root.zone_mc.Gatherable_mc._y = currGatherable.attributes.YPos;
         //set the gatherable Y
         //load the gatherable Icon
         trace(currGatherable.attributes.Icon);
         trace(currGatherable.attributes.XPos);
         trace(currGatherable.attributes.YPos);
      }
   }
}
var map_xml = new XML();
map_xml.ignoreWhite = true;
map_xml.onLoad = function(success) {
   if (success) {
      GenerateMap(this);
   } else {
      trace("Error loading XML file");
   }
};
map_xml.load("new_nodes.xml");


Code:

<zone>
      <a_zone name="Elwynn Forest" image="http://localhost/gatherer/images/zone/Elwynn.jpg">
        <Gatherable Gtype="Ore" XPos="170" YPos="202" Icon="http://localhost/gatherer/images/ore/OreCopper.png" GatherableName="Copper - Requires Mining level 1" />
        <Gatherable Gtype="Herb" XPos="150" YPos="425" Icon="http://localhost/gatherer/images/herb/HerbSilverleaf.png" GatherableName="Herb - Requires Herbalism level 1" />
        <Gatherable Gtype="Treasure" XPos="256" YPos="488" Icon="http://localhost/gatherer/images/treasure/TreasureChest.png" GatherableName="Treasure Chest" />
      </a_zone>
    </zone>

Button Inside MovieClip Not Functioning [renamed]
I have a MovieClip called "mousetest" that I can move from a button on the stage:


Code:

Código:
on (click) {
_root.mousetest._visible = 1;
_root.mousetest._x=210;
_root.mousetest._y=201;
}
Inside this MC "mousetest" I have a buttom that "close" (hide/move) the MC but I can't make this WORK, I try evrything I don't know if is a problem using _root

Boton dentro del MC

Code:

on (click) {
_root.mousetest._visible = 0;
_root.mousetest._x=800;
_root.mousetest._y=800;
}
But until know I don't know how to make _global work or if this is the best solution someone can give a hand on this one? (step by step plz)

Thank you.
_LOBO_


I Don't have a clue how to implement _global
http://www.kirupa.com/developer/acti...addressing.htm

Button Inside MovieClip Not Functioning [renamed]
I have a MovieClip called "mousetest" that I can move from a button on the stage:


Code:

Código:
on (click) {
_root.mousetest._visible = 1;
_root.mousetest._x=210;
_root.mousetest._y=201;
}
Inside this MC "mousetest" I have a buttom that "close" (hide/move) the MC but I can't make this WORK, I try evrything I don't know if is a problem using _root

Boton dentro del MC

Code:

on (click) {
_root.mousetest._visible = 0;
_root.mousetest._x=800;
_root.mousetest._y=800;
}
But until know I don't know how to make _global work or if this is the best solution someone can give a hand on this one? (step by step plz)

Thank you.
_LOBO_


I Don't have a clue how to implement _global
http://www.kirupa.com/developer/acti...addressing.htm

Loading An Image Dynamically Into A Movieclip Inside A Button
Well I am trying to make a component in which i can load an image dynamically. Once done i will be able to zoom in and zoom out as well as pan the image.

The problem is when i use the image directly there is no problem with panning but when done dynamically it does not happen.

to load an image -

_root.ThePic.loadmovie(imgname);

{ ThePic is a movieclip have an invisible button. Inside the button i have another movieclip within which the image gets loaded)

I would appreciate if someone could help me at the earliest.

Loading + Storing An External Image As A MovieClip, Then Displaying It Later
I have a class:


Code:
class Component
{
var image_mc:MovieClip; // the image data itself
var image_filename; // filename of the image

function Component(filename)
{
image_filename = filename;
image_mc = new MovieClip();
loadMovie("http://localhost/" + image_filename, image_mc);
}
}
Then in some other code, of course, the object is created:


Code:
var _root.foo:Component = new Component("helloworld.jpg");
How can I display root.foo’s image (imagemc) on the stage at some point down the road? I have tried something similar to root.add(root.foo.image_mc); and that didn’t work (not even if I set the _x, _y, and _visible variables of the imagemc member).

How Do I Open An Image In A New Window? [renamed]
... although I forgot AS on how to do it

How do I load an image in another window by clicking a button or MC?

How Do I Open An Image In A New Window? [renamed]
... although I forgot AS on how to do it

How do I load an image in another window by clicking a button or MC?

MovieClip To BitmapData
I'm trying to take a movieclip (exported for actionscript in the first frame) and eventually use copyPixels to crop and render it to the stage, but I am stuck just trying to get it to display at all. Am I making some stupid mistake or going about this the wrong way? Nothing appears on the stage at all when I compile.


Code:
import flash.display.BitmapData;

var mc:MovieClip = _root.createEmptyMovieClip("mc_guy", _root.getNextHighestDepth());
//mc.attachMovie("mc_guy", "mc_guy", mc.getNextHighestDepth()); //this attaches the mc properly when uncommented
//note: the content of the movie clip is about 225px wide x 400px tall, positioned at 0,0
var myBitmapData:BitmapData = new BitmapData(400, 400);
myBitmapData.draw(mc_guy);
mc.attachBitmap(myBitmapData, mc.getNextHighestDepth());
Thanks for any help. 8^)

How To Load Image From External Source [renamed]
Yeah i should know this by now but how do u load an image from an external source?

How To Load Image From External Source [renamed]
Yeah i should know this by now but how do u load an image from an external source?

Using BitmapData To Draw A Movieclip Into Another One
How to draw a movieclip into another movieclip using bitmapdata?

Movieclip To BitmapData And Viceversa
Hello community!

Any one can tell me how to make that conversion???

Thanks for read and happy new year!!!!!!

How To Load BitmapData From MovieClip
I'm trying to use the Loader class to load an image which then becomes BitmapData which I can draw onto the Shape class.

So far, I can load the image successfully however I can only seem to attach it to a movieclip whereas what I need to do is have it as actual Bitmap data or something so that I can "Draw" it onto the Shape. The whole point of this is so that it's "drawn" onto the shape where my drawing tool can draw on it and such with it being on the same layer.

Perhaps you can help me find a way to make a Movieclip into BitmapData which can be drawn onto the Shape class?

For example, so far I have:


Code:
function ImageLoadAsBitmap(u:String,target,Ypos,Xpos){
preLoader.alpha = 100;
var targetClip = target;
var positionY = Ypos;
var positionX = Xpos;
var _loader:Loader = new Loader();
var request:URLRequest = new URLRequest(u);
_loader.load(request);
targetClip.addChild(_loader);
targetClip.y = positionY;
targetClip.x = positionX;

myBitmap = new BitmapData(targetClip.width, targetClip.height,true,0x00FFFFFF)
myBitmap.draw(targetClip)
}
However I get the error:


Code:
ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData$iinit()
at imagemaker_fla::MainTimeline/ImageLoadAsBitmap()
Lets say I've created a Shape object like so:


Code:
var drawing_layer1:Shape=new Shape();
this.addChild(drawing_layer1);
drawing_layer1.x=imageBG.x;
drawing_layer1.y=imageBG.y;
How do I, using the ImageLoadAsBitmap "draw onto" the drawing_layer1 with loaded image?

Thank you so much if you can help me I've been going mad over this.

[F8] Copy MovieClip Contents Using BitmapData
Hi,

I have a movie clip of which I want to copy the visual representation of its contents, using BitmapData. The problem is that the movie clip's registration point is in the center of the movieClip (and needs to be left that way for other reasons) and so when I go to create the BitmapData, I only get the bottom-right quarter of the movieClip.



Code:
myBD = new BitmapData(612, 373, true, 0x000000);

var myMatrix:Matrix = new Matrix();
var myColorTransform:ColorTransform = new ColorTransform();
var blendMode:String = "normal";
var smooth:Boolean = true;

myBD.draw(original_mc, myMatrix, myColorTransform, blendMode, new Rectangle(-306, -186.5, 612, 373), smooth);

my_mc.attachBitmap(myBD, 0, "auto", true);


I thought that if I used -306, -186.5 values in the Rectangle, it would compensate for the movieClip having a centered registration point...since 0 - (612/2) = -306... so that should be the top left corner of the mc...

However, even with those values I still only get the bottom-right 'quarter' of the mc.

Any ideas?

Thanks!
-b.

How To Duplicate Movieclip With Attached BitMapData
Hi,

I have a movielclip with attached BitMapData. I am trying to duplicate the clip, though when I try to do that, the duplicated movie clips show up as being blank.

Is this possible to do?

Thanks,

-Dan

Positioning BitmapData Inside A MovieClip
Is there a way to move the X and Y position of bitmap data after it's loaded inside of a movie clip. The X and Y position is set to 0 by default.

I want to center the bitmap data inside of the movie clip so that the center point or the movie clip is x=0 y=0.

Extract Bitmap Or BitmapData From MovieClip
Hi guys

I've been looking for a solution for hours now. I have a movieclip which contains an image. Created by doing: put image on stage, convert to symbol, movieclip type, ok.

I'd like to extract this bitmap because I want to use (somewhere else): graphics.begintBitmapFill(); but this method needs a BitmapData object and not a movieclip to create a repeating background (in my case).

So: how do I extract the Bitmap or the Bitmap data from a MovieClip?

Please mind that attaching BitmapData as a base class to this symbol is NOT AN OPTION

BitmapData GetPixel On Rotating MovieClip?
This may be more of a math question as I try variations on this problem. I'm trying to get the rgb value from a pixel area on the stage that a bitmap is rotating in. I made it work for the y by adjusting the getPixel location in the bitmap, but I think I need to use some sin/cos to "rotate" the x/y location for the getRGB...

am I making this harder than it needs to be?

any ideas?? fla attached...

Thanks!

BitmapData Doesn't Snapshot Movieclip
I want to load a picture into a movie clip, and then use the draw() function of BitmapData to snapshot it. My codes are as follows:

//---------------------
import flash.display.BitmapData

var img_mc = this.createEmptyMovieClip("img",1);
var mcl:MovieClipLoader = new MovieClipLoader();
mcl.loadClip("pic.jpg",img_mc);

var picBitmap = new BitmapData(83,104,false);
picBitmap.draw(img_mc);
this.createEmptyMovieClip("holder_mc",2)
holder_mc.attachBitmap(picBitmap,2);

//----------------------
But it doesn't work...
Can anyone do me a favor? Thanks!

Load Image Into Bitmapdata
Hi

I am loading bitmapdata from the library like this

linkageId = "landscape";
myBitmapData = BitmapData.loadBitmap(linkageId);

Than attach this bitmap image to a movie.

mc = this.createEmptyMovieClip("mc", 0);
mc.attachBitmap(myBitmapData, 0);

Can someone give me the code to load my image using loadMovie instead of from libarary and attach it to movie clip mc.

BitmapData Of On-stage Image?
If I have a bitmap, let's say a .png, on the Stage at compile time (as opposed to instantiating it), is there a way to access the .png's BitmapData? Many thanks.

Can You Export An Image From BitmapData
Once you have done fun stuff with BitmapData in Flash 8 is there anyway you can export the image back to a server as a JPEG or PNG?

TIA

Kevin

Image Transperancy In BitmapData
Folloing are the excerpts of my code in AS2:
I have image1 as and image2 on my stage. The image2 is a transparent GIF and works good transparantly when moved, roatated etc. this image2 is merged over image1 on a button click instance.
Problem with the source is that as soon as the image is merged it (image2) looses its transparancy and converted to opaque again. How to resolve this issue?








Attach Code

on (press) {
import flash.display.BitmapData;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.geom.ColorTransform;

var bmp1:BitmapData = new BitmapData(int(_parent.m1w.text), int(_parent.m1h.text), false, 0x00FFFFFF)
bmp1.draw(_parent.m1, new Matrix());

var bmp2:BitmapData = new BitmapData(int(_parent.m2w.text), int(_parent.m2h.text), false, 0x00FFFFFF);
bmp2.draw(_parent.m2, new Matrix());

var bmpmrgd:BitmapData = new BitmapData(int(_parent.m1w.text)+100, int(_parent.m1h.text), false, 0x00FFFFFF);
bmpmrgd.merge(bmp1, new Rectangle(int(_parent.m1x.text)-40, int(_parent.m1y.text)-10, int(_parent.m1w.text), int(_parent.m1h.text)), new Point(int(_parent.m1x.text), int(_parent.m1y.text)), 250, 250, 250, 100);
bmpmrgd.merge(bmp2, new Rectangle(0, 0, int(_parent.m2w.text), int(_parent.m2h.text)), new Point(int(_parent.m2x.text), int(_parent.m2y.text)), 250, 250, 250, 100);

_parent.createEmptyMovieClip("mrgdclip", _parent.getNextHighestDepth());
_parent.mrgdclip.attachBitmap(bmpmrgd, mrgdclip.getNextHighestDepth());

_parent.m1._visible = false;
_parent.m2._visible = false;
_parent.m1x._visible = false;
_parent.m1y._visible = false;
_parent.m1w._visible = false;
_parent.m1h._visible = false;
_parent.m2x._visible = false;
_parent.m2y._visible = false;
_parent.m2w._visible = false;
_parent.m2h._visible = false;
_parent.b1._visible = false;
}

Image File To BitmapData
Im doing this game as final project for graduation and I want all imagery available and dynamicly loadable from a directory without a need to have it all imported into a library.

So is there a way to load external image and convert it to BitmapData or get its content at pixel level?

[edit]Cause I dont see any. If I load it with loadMovie, it becomes content of a MC and I dont know af any functionality to work with a MC as with a bitmap and any other loading method is not know to me too.[/edit]

BitmapData Of On-stage Image?
If I have a bitmap, let's say a .png, on the Stage at compile time (as opposed to instantiating it), is there a way to access the .png's BitmapData? Many thanks.

BitmapData From Embedded Image?
Hey everyone,

How would you fill a bitmapData with an embedded image?

This is what I have so far. I've read the language reference, but I have no clue as to where to go from here.


Code:
// Embed images
[Embed(source="texture.PNG")]
private var Texture:Class;

private function createBox(x:Number, y:Number, w:Number, h:Number, friction:Number, restitution:Number, static:Boolean, mode:uint, fill:Object):void {
// Modes: 0 - solid fill, 1 - gradient fill, 2 - bitmap fill
trace("function:createBox");

bodyDef = new b2BodyDef();
bodyDef.position.Set(x, y);
boxDef = new b2PolygonDef();
var boxCenter:b2Vec2 = new b2Vec2(w, h);
boxDef.SetAsOrientedBox(w, h, boxCenter);
boxDef.friction = friction;
boxDef.restitution = restitution;
if (static) {boxDef.density = 0;} else {boxDef.density = 1.0;}
bodyDef.userData = new Shape();
if (mode == 0) {
bodyDef.userData.graphics.beginFill(fill);
bodyDef.userData.graphics.lineStyle(0, 0x000000);
bodyDef.userData.graphics.drawRect(0, 0, w, h);
bodyDef.userData.graphics.endFill();
} else if (mode == 1) {

} else if (mode == 2) { /// THIS IS WHERE THE PROBLEM STARTS ///
var bitmapdata:BitmapData = new BitmapData(5, 5, false);
bitmapdata.draw(fill); //bitmapdata.draw(Texture); doesn't work either
bodyDef.userData.graphics.beginBitmapFill(bitmapdata);
bodyDef.userData.graphics.drawRect(0, 0, w, h);
bodyDef.userData.graphics.endFill();
}
bodyDef.userData.width = w * 2 * 30;
bodyDef.userData.height = h * 2 * 30;
addChild(bodyDef.userData);
body = m_world.CreateBody(bodyDef);
body.CreateShape(boxDef);
body.SetMassFromShapes();
}
It gives me an error that I cannot draw Classes or Objects into bitmapData, but I don't know what else I could do...

Thanks for reading!

Image Class Using BitmapData?
Can someone explain what is going wrong with this simple class:


ActionScript Code:
class image extends MovieClip {
    public var bmd:flash.display.BitmapData;
   
    public function image() {
        super();
    }
    public function loadImage(p_url:String, p_loader:MovieClipLoader) {
        if (p_url) {
            var loadURL:String = p_url;
        } else {
            var loadURL:String = "/img/"+this._name+".jpg";  //default image location if no URL provided
        }
        if (p_loader) {
            var imageLoader = p_loader;
        } else {
            var imageLoader = new MovieClipLoader();
            trace("making my own loader");
        }
        imageLoader.addListener(this);
        var loadTarget = this.createEmptyMovieClip("loadTarget", this.getNextHighestDepth()); //temporary holder
        imageLoader.loadClip(loadURL, loadTarget);
    }
    function onLoadInit(targetMC:MovieClip) {
        trace("loading complete on "+targetMC);
        var imgWidth:Number = targetMC._width;
        var imgHeight:Number = targetMC._height;
        this.bmd = new flash.display.BitmapData(imgWidth, imgHeight, true, 0x00000000);
        this.bmd.draw(targetMC);
        this.attachBitmap(this.bmd);
        targetMC.removeMovieClip();
        this._x -= this._width/2;
        this._y -= this._height/2;
        this._parent.imageLoadComplete(this);
    }
    function onLoadStart(targetMC:MovieClip) {
        trace("loading started on "+targetMC);
    }
}


In my library, I have a MovieClip symbol defined type of image and exported in the first frame.

If I don't removeMovieClip(targetMC), I can see that my image loads fine. But when I removeMovieClip, it disappears?

Any help would be greatly appreciated.

Jase

BitmapData Image Resize Does It Have To...
I am creating an environment in my Flash using images as the background. I know how to use the BitmapData to resize images to fit to my screen, but the only way to do this (that I know of) is to load the image into Flash from the library or externally. In this case I would like the images to be in a MC, because I will be animating them with other images and have other animations on top of them. Is there a way to use the BitmapData to fix the scaling image issue in Flash without having to load the images from the Library or externally?

Loading Two Swf's Next To Each Other [renamed]
ok wow!! i need HELP big time with some stuff! first of all..im trying to load an .swf movie (or file which ever it is) into my main movie...well the way im doing that is by clicking a button and then the movie loads...then im wanting to be able to click another button and load a different movie BUTTTT when i do this right now the second button's movie loads right over the first buttons movie!! what do i do?!?


also im wanting to make a text scroller with JUST the slider. how can i go about this?

p.s.
would appreciate just verbal help b/c i would like to try to do this without using someone elses stuff ...if thats ok...?!

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