Couldnt get this to work for some reason i think its because its used from
within a class, soon as the mask is applyed it throws an error!
Ive decided to use SWFs insted of masking an image, but for some reason its not
correctly sizing the file its loading!
then the actual code to initiate the load is...
banner.loadImage(banners/ + xmlClass.xmlData.BannerRef + .swf, 0,0,
bannerArea, 420, 173);
The code to load the file is
public function loadImage(filename:String, mcX:int, mcY:int,
mcName:MovieClip, imgWidth:int, imgHeight:int):void
{
_mcName = mcName;
_imgWidth = imgWidth;
_imgHeight = imgHeight;
_mcY = mcY;
_mcX = mcX;
var imageLoader:Loader = new Loader(); // Set loader
try
{
var imageURL:URLRequest = new URLRequest(filename); // Set file name
imageLoader.load (imageURL);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
imgLoadComplete);
trace(DEBUG [imageLib-loadImage]: Loading image: + filename);
}
catch (err:Error)
{
trace(WARNING [imageLib-loadImage]: No files are loading ( + err
+ ));
}
}
SM
- Original Message -
From: jonathan howe
To: Flash Coders List
Sent: Thursday, April 10, 2008 1:50 PM
Subject: Re: [Flashcoders] Problem when applying dynamic mask [AS3]
Hi, Stuart,
This looks like a job for global function getDefinitionByName(), my new bff
(learned from this list).
You can't instantiate item just as a string. You need to call
getDefinitionByName(item) and then use that as your class def.
var classReference:Class = getDefinitionByName(item);
return classReference();
-jonathan
On Thu, Apr 10, 2008 at 7:55 AM, Stuart (FunkDaWeb) [EMAIL PROTECTED]
wrote:
Hi i have another problem this time its to do with masking an object, here
is the code that creates a movieclip then loads an image into to...
bannerArea = newMovieClip(0xff, 0, 0, 420, 173);
addChildAt(bannerArea,0);
banner.loadImage(banners/ + xmlClass.xmlData.BannerRef + .jpg,
0,0, bannerArea, 420, 173);
Then an item is called from the library and applyed as a mask...
var maskClip = loadLibrary(maskMC +
xmlClass.xmlData.Mask.toString());
addChild(maskClip);
bannerArea.mask = maskClip;
This is the function that calls the item from the library (this isnt
currently working correctly but we have found a quick fix till we have
worked out the masking problem)...
private function loadLibrary(item)
{
var maskClip = new item();
return maskClip;
}
Quick fix for code...
private function loadLibrary(item)
{
var maskClip = new maskMC1();
return maskClip;
}
The problem areas is not loading items from teh library but its when it
applys the mask i.e. bannerArea.mask = maskClip;
Any one have any ideas?
SM
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
--
-jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders