Need to apply a mask to loaded swf
this is what I need to fix: http://mespinach.com/needmask/
this is my code I've been looking all over for an example of setting a mask using AS2
I have a container MovieClip I create dynamically I've tried to attach a movieclip to the container then set mask before loading the swf
I would like to know how to dynamically generate a mask or use a symbol from the library or stage if need be whatever works.
This is my code.
var container:MovieClip = createEmptyMovieClip("container", 3);
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
mcLoader.loadClip("slideshow.swf", container);
function onLoadInit(mc:MovieClip) {
container._width = 600;
container._height = 400;
container._x = 200;
container._y = 100;
function onLoadInit(mc:MovieClip) {
container._width = 600;
container._height = 400;
container._x = 200;
container._y = 100;
var r:MovieClip = createEmptyMovieClip("rectangles", 2);
r.beginFill(0xcc00cc, 100);
r.moveTo(20, 20);
r.lineTo(160, 20);
r.lineTo(160, 160);
r.lineTo(20, 160);
container.setMask(r);
change the values as your need.
Similar Messages
-
Dynamic Text in Externally Loaded swf
hi. i have a dynamic text field in an externally loaded swf. Its a digital clock so i want the numbers to update in the dynamic text field.
this is not my exact code but it is very similar. i show below that i add the loader.swf, and once its loading is complete, i can work on its movieclips and add event listeners to its buttons, etc. but i cannot change the dynamic text field (its "classic text" set to "dynamic text"). after running this, the text just stays empty as it is in the external swf).
here is the sample code:
var loader:Loader = new Loader();
loader.load(new URLRequest("loader.swf"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
function loaded(event:Event):void{
addChild(loader);
var loader_mc:MovieClip = (loader.content as MovieClip)
loader_mc.myMovieClip.gotoAndStop(2);//***this works
loader_mc.myButton_btn.addEventListener(MouseEvent.CLICK, clickMe);//***this works
loader_mc.myText_txt.text = "12";//***this doesn't work******
please help. thanks!Did you embed the font in the textfield--it needs to be done in the loaded swf when you create it? One other thing to check is that the color for the textfield is not the same as the background it sits on.
-
Load swf into movieclip // play pause buttons
I am going out of my mind trying to get this to work. I can do it in AS2 without a hitch - but not AS3.
I just need to load an external swf file into an empty movieclip. Then I have 2 buttons play and pause that need to be on the top layer of the new movie and they need to play and pause the loaded swf file.
I have tried a number of things and nothing is working. Please help.
Thank you in advance.
Shawnayou can use:
var ldr:Loader=new Loader();
addChild(ldr);
ldr.load(new URLRequest("yourswfthatyouwanttoload.swf"));
addChild(yourplaybtn);
addChild(yourpausebtn);
yourplaybtn.addEventListener(MouseEvent.CLICK,playF);
yourpausebtn.addEventListener(MouseEvent.CLICK.pauseF);
function playF(e:Event){
MovieClip(ldr.content).play();
function pauseF(e:Event){
MovieClip(ldr.content).stop(); -
Applying an onDrag actionscript to a loaded swf
I want to make a loaded swf file dragable within the main
stage. Can someone point me to a tutorial or show me how to do it?
Thank you!This one took a few tries to get right. But I think I figured
it out for yuh'. I assumed you were using a "ScrollPane" for your
scrolling and that there was a button inside of that component. Let
me know if this is wrong. It shouldn't be too different even if
you're not using the "ScrollPane". Aslo, all the code below goes on
the main timeline.
notes:
"container" is the empty clip that holds the content.
"mc" is the MovieClip inside of the ScrollPane ( located in
the loaded *.swf ).
"mouseIsDown" is a boolean ( true/false). It checks to see if
the user is holding down on the mouse or not.
The rest is pretty easy to figure out. -
How to access properties of symbols in loaded SWF?
I'm making the migration from Flash to Flex, but I'm running
into a dead end on one particular area: accessing and manipulating
properties of symbols in a loaded SWF.
The SWF is actually a simple library of a detailed parts
illustration. I would like to load the entire SWF in position, and
be able to change the attributes (i.e. colors) of individual
symbols (or parts of the illustration). I can load, display and
manipulate each symbol separately, but I need the parts to remain
in place.
The original art was created in Illustrator and exported as
SWF using the symbols palette.
I can always go back to Flash, but I'm forcing myself to move
forward and do this project in Flex (baptism by fire!!).
Is there some sort of dot notation to access the symbols from
within the SWF, without loading them all separately?
Let me put this another way: it appears that I can load an
SWF and then instantiate each symbol in that SWF, and then load
each symbol to the 'stage' (or whatever it's called in Flex)
separately.
I can certainly instantiate each symbol separately, and then
align it on stage, but it seems to me to be bass-ackward to do it
that way, expecially since I created the original SWF with
everything in position.
Is there no way to access the attributes of the individual
symbols within an SWF without separately instantiating them?
I'm just having trouble getting my head around this. Any help
is greatly appreciated.Okay, I took a look at this info and it's what I was already
doing.
Here's a simplified example of what I'm trying to do, using
the example in the swf9.pdf file.
Let's assume I've created a SWF with a "BlueSquare" movieclip
(in the symbols panel in Flash, exported for AS). In that clip,
there is another symbol called "Star". I import the SWF and
BlueSquare symbols in with the following code:
<mx:Script>
<![CDATA[
[Embed(source=”../assets/circlesquare.swf”)]
[Bindable]
public var LogoCls:Class;
[Embed(source=”../assets/circlesquare.swf”,
symbol=”BlueSquare”)]
[Bindable]
public var LogoClsBlueSquare:Class;
</mx:Script>
If I instantiate the BlueSquare on stage, it includes the
Star symbol when previewed, but I can't figure out how to get at
the Star symbol to change color. If I apply a color change to the
symbol, it changes the entire BlueSquare symbol.
If I instantiate the Star symbol separately, I can then
position it on the stage and make changes, but that requires
positioning it with actionscript. I'm trying to not have to
position a sub-element of my actual artwork because of it's
complexity.
I'd like to display the main movieclip (or sprite) with the
ability to access the attributes of a sub-movieclip or
sprite. -
I have a Flash movie that automatically opens another Flash movie inside it. The main swf has a "Start" button at the bottom. When I click the Start button I want to unload the swf that loaded automatically (as a placeholder) and load a new Flash video swf. I'm doing this to create a placeholder for the video. I don't know what code I need to use on the button to unload the automatic swf and load the new swf video.
if you don't need to stop any loaded streams (like sound/video), you can just reuse the same loader to load the next swf. otherwise, apply unloadAndStop() to your loader before loading the next swf.
-
Loader component loading swf bigger as it is?
Im loading second.swf in main swf using a loader component,
second swf is has a stage size of 800*85, i load it in a
component with the same size, and scaleContent = true
This goes wrong, after investigating second.swf it actualy
has a stage size but some components on the size like a textfield
goes beyond the stage (which is necesarry to be able to load enough
text in it (it starts scrolling then to be visible on stage), when
i test second.swf, i get a 800*85 swf.
But when i include it in an other swf and autoscale it, it
seems like flas includes the objects outside the stage from
second.swf to do the scaling.
Ideas to avoid this fenomenon ?the loaded swf will include objects that are off-stage. it
wouldn't be satisfactory if those objects were "omitted".
if you want second.swf to appear the same in main.swf,
main.swf will need to have the same stage size as second.swf or
you'll need to mask second.swf's target to make it appear the
same. -
How do I interact with a loaded swf?
Hi,
I have a "lesson" that I'm building that will display a series of "pages" based on an XML file. I have simple navigation buttons that work to page through the XML file. but I'd like to use load an external SWF file with buttons to use as my navigation panel. Everything is AS 3.0. The code to load the navigation movie looks like this:
// load navigator
navLoader = new Loader;
navLoader.contentLoaderInfo.addEventListener(Event.INIT, handleInit);
navLoader.x = 50;
navLoader.y = 200;
lessonSprite.addChild(navLoader);
navLoader.load( new URLRequest("Navigator1.swf"));
The loaded navigation movie has two buttons. How do I add an event listener to those buttons so that they call a function in the parent movie so I can detect when the user clicks on the button named "GoNext" in the loaded movie? I've tried several ways but I've had no luck. Could someone please point me in the right direction? This navigation panel is only one application of this sort of communication that I'll need in other parts of this type of lesson so I really need to figure out how to detect user interaction interaction with the loaded movie. Guess I need to know how to call a function in the parent movie from the loaded movie.
Thanks,
Peter H.Hey Pete,
The answer that you seek and the simplest one as well will be from the MouseEvent. that you will most likely have applied to your loaded swf.
As long as both swfs are in the same domain, you wont have any issues with security and therefor, the MouseEvent. which bubbles up, will be able to reach your swf file which has loaded it.
You can then write your code in your loaded swf to simply listen to the loadedMovieClip by targeting the contents of navLoader just like this,
navLoader.content.addEventListener(MouseEvent.MOUSE_DOWN,onDown)
protected function onDown(me:MouseEvent){
now providing you have given your two buttons names in your loaded swf, you will be able to perform addition tasks by receiving the name of the target.
protected function onDown(me:MouseEvent){
var btnClip:Movie= me.target as MovieClip
var btnName=btnClip.name
if(btnName==(button1)){
//do the following
}else{
//it was button two
button1 was just a random name in this case .
This will do the trick -
Hi all..
i have a problem i´ve been try to load a swf file into another.. and i do can do it... but when i do so... the dimensions of the loaded file doesn´t crop on what they should be... i mean:
Movie A load Movie B
in Movie B i have an animation where an object came from one side to another, but all this is not on the dimensions of my fla, but when i load it into the other shows that content outside of the flash properties dimensions and i want to crop the dimensions of the loaded file ...
this is the code to load this file:
function startLoad2()
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest('cards_promo.swf');
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler2);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler2);
mLoader.load(mRequest);
function onCompleteHandler2(loadEvent:Event)
loadEvent.currentTarget.content.x = 355;
loadEvent.currentTarget.content.y = 215;
//loadEvent.currentTarget.content.width = 223;
//loadEvent.currentTarget.content.height = 33;
addChild(loadEvent.currentTarget.content);
function onProgressHandler2(mProgress:ProgressEvent)
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
loaded_text02.text = percent + ' %';
if (percent > 95)
removeChild(loaded_text02);
trace(percent);
startLoad2();
here is the page with the problem
http://www.sotoautopartes.com/
the problem is in the banner and the visa and master card animation, this animation should be croped to the gray box with the red stroke
i do hope that someone can help me to solve this problem
or give me other alternative. to solve this small problem...
well thanks a lot
Regards
CesarHi,
I've try it... but like i have another dinamic movie, when i apply the mask to the top frame where is loaded... the other movie doen't is not showed cuz is not in the mask area, and when i make the mask area biger the result is the same. the "animation" is in all the banner and i dont want that result.
I'll look in depth properties for the addChild maybe the answer to this problem is around there.
if you have any other subjestion please let me know
Regards
Cesar -
How to use semi-transparent mask on external swf?
I want to use semi-transparent mask on external swf for smooth transition. I'm using
clip.cacheAsBitmap = true;
mask.cacheAsBitmap = true;
clip.setMask(mask);
Everything works fine. But when I use
loadMovie("http://www.url.com/movie.swf", "_root.clip");
clip.cacheAsBitmap = true;
mask.cacheAsBitmap = true;
clip.setMask(mask);
it doesn't work... what am I doing wrong?well if your loadMovie is on the same timeline as the code you are setting as mask, then you dont need _root.
And sorry, I forgot there was an issue with masking the main mc that loadMovie is loading into. So what I did was put clip inside another mc and called that mc "container" so then my code would look like :
masker.cacheAsBitmap = true;
container.cacheAsBitmap = true;
container.setMask(masker);
container.clip.loadMovie("movietoload.swf");
download the two swfs attached, and open main.swf to see. -
Load SWF file in main SWF with parameters
Hello everybody,
I recently got a new flash Application which is a Photo Gallery.
This App is made of multiple folders (source files), a FLA file, a SWF with its javascript SWFObject and an Html page which instantiate this App with some parameters (size, config file path, ...).
It needs an XML file to find all the Photos it displays, to do it I need to configure my application in the HTML Page and give it the "xml_path" :
var so = new SWFObject("index.swf", "gallery", "249", "249", "10", "#111111");
so.addVariable("xml_path","load/config.xml"); // this line is adding the path to the xml file make sure that it's name is xml_path
so.addParam("allowfullscreen","true");
so.write("flashcontent");
By the way, I have a second application, the WebSite, which have to display the Gallery SWF in its "Gallery" page.
Here is how I do it at the moment (in ActionScript3) :
var swfRequest:URLRequest = new URLRequest("C:/......../Galerie/index.swf");
var swfLoader:Loader = new Loader();
//Charge le SWF Galerie dans le SWF Site
swfLoader.load(swfRequest, context);
container1.addChild(swfLoader);
//Positionne le SWF
swfLoader.x=10;
swfLoader.y=120;
It successfully loads the Gallery application but It shows an error telling me it doesn't find the XML configuration file... In the HTML file I simply had to write the "so.addVariable("xml_path","load/config.xml");" to tell where the XML file is...
So, my question is : How can I integrate my SWF application giving it some parameters like above, in Action Script 3?
Thank you ,
PatrickNo, nothing with HTML.
I have 2 SWF applications. One is the Gallery, and the second is my Main Page.
My Main Page must integrate the Gallery module in one of its page.
The problem is when I try to integrate it, I think I must give de future loaded SWF some parameters like this :
(My Main SWF loading in HTML)
var so = new SWFObject("WebSite.swf", "flashcontent", "520", "700", "10", "#111111");
so.addParam("allowfullscreen","true");
so.addParam("allowScriptAccess","always");
so.addParam("menu","false");
so.addParam("wmode","opaque");
so.addParam("bgcolor","#000000");
so.setAttribute("id","flash");
so.write("flashcontent");
It was for the Main App. For my Gallery SWF I had to load it like this (in HTML) :
var so = new SWFObject("Gallerie.swf", "gallery", "249", "249", "10", "#111111");
so.addVariable("xml_path","Galerie/config.xml"); // this line is adding the path to the xml file make sure that it's name is xml_path
so.addParam("allowfullscreen","true");
so.write("flashcontent");
So at the beginning I had 2 different projects with an HTML page for each.
Now I wan't to directly integrate the Gallery SWF into the Main SWF. And as you have seen I must give it some parameters such as the "xml_path" and "allowfullscreen". This must be done in ActionScript 3 and I don't know how...
I think I have to use FlashVars but I don't know how. As I said before, I have tried using the loaderinfo.parameters, but it is in read-only...
Do you have an idea of how I can make it work ? -
Using TextSnapshot class on a loaded SWF on an iPad
Hello, I am creating an iPad app. I am loading SWF files using a Loader object, then placing them in a movieclip and setting a SWFLoaders source property to this clip. Before I add the clip to the SWFLoader control I am using the TextSnapshot class on it, to retrieve an array with the getTextRunInfo method.
All this works fine when I test it on my desktop machine. However, on the iPad it causes the app to crash when a control using this clip is added to the stage. Can you still use TextSnapshot with an iPad, is there a workaround for this? Thanks for your help.We are a university. most of our books are SWF files. We have been using iPad/FlexBuilder 4.5 to successfully view the contents of these books.
All navigation (i.e gotoandstop(page), etc work fine. Gestures for pageforward/pageback, zoom, pan work fine also.
Not sure I understand your comment.
However, there IS a specific problem with text snapshot. Below is a short code piece used to highlight text on a page.
If you remove the failing line everything works fine.
If you "debug" the iPad device everything works fine when you execute the code on the iPad
if you create a release build, when the application starts and the "findtext" line is executed the "app" freezes. No error message. The try/catch does not seem to catch any error.
This is something we really need for our app. If this is a bug how should we report it.
Thanks for your help.
public function highlightText(txt:String):void {
var start_pos:int = 0;
try {
if (txt == null || txt.length == 0) { return; }
infoMessage("highlightText: " + txt);
allText = _libMC.textSnapshot;
allTexts.push(allText); // no reason for this but must do to make work
start_pos = allText.findText(start_pos, txt, false); <<<<<< Failing line ====================================
infoMessage("start_pos: " + start_pos);
catch (err:Error) {
infoMessage("error: " + err.message);
finally {
infoMessage("finally"); -
How to unload externally loaded swf which contains 3D Carousel?
Hello to all
I am learning AS3 and have been taking on various tutorials found on the net. While learning about AS3 I came across a lesson on http://tutorials.flashmymind.com/2009/05/vertical-3d-carousel-with-actionscript-3-and-xml/ titled "Vertical 3D Carousel with AS3 and XML".
I completed the tutorial and all worked fine so I then wanted to load the swf into a existing project. The loading of the swf goes fine and when I unload my loader it is removed but only visually as in my output panel in flash CS5 I get an error as follows
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at carousel_c_fla::MainTimeline/moveCarousel()
this error repeats over and over again slowing my swf movie.
So does this mean my main flash movie trying to still play / find my unloaded 3D Carousel?
If so how do I unload remove all the AS3 that is trying to run from the 3D Carousel?
I have included the AS3 below from the tutorial page and I understand that this is what I have to remove to "break free" from the 3D Carousel swf when it is unloaded. This is where I am stuck as my knowledge of AS3 is limited - Can you guys / girls help?
//Import TweenMax
import com.greensock.*;
//The path to the XML file (use your own here)
// old var from tutorial - var xmlPath:String = "http://tutorials.flashmymind.com/XML/carousel-menu.xml";
var xmlPath:String = "carousel-menu.xml";
//We'll store the loaded XML to this variable
var xml:XML;
//Create a loader and load the XML. Call the function "xmlLoaded" when done.
var loader = new URLLoader();
loader.load(new URLRequest(xmlPath));
loader.addEventListener(Event.COMPLETE, xmlLoaded);
//This function is called when the XML file is loaded
function xmlLoaded(e:Event):void {
//Make sure that we are not working with a null variable
if ((e.target as URLLoader) != null ) {
//Create a new XML object with the loaded XML data
xml = new XML(loader.data);
//Call the function that creates the menu
createMenu();
//We need to know how many items we have on the stage
var numberOfItems:uint = 0;
//This array will contain all the menu items
var menuItems:Array = new Array();
//Set the focal length
var focalLength:Number = 350;
//Set the vanishing point
var vanishingPointX:Number = stage.stageWidth / 2;
var vanishingPointY:Number = stage.stageHeight / 2;
//We calculate the angleSpeed in the ENTER_FRAME listener
var angleSpeed:Number = 0;
//Radius of the circle
var radius:Number = 128;
//This function creates the menu
function createMenu():void {
//Get the number of menu items we will have
numberOfItems = xml.items.item.length();
//Calculate the angle difference between the menu items (in radians)
var angleDifference:Number = Math.PI * (360 / numberOfItems) / 180;
//We use a counter so we know how many menu items have been created
var count:uint = 0;
//Loop through all the <button></button> nodes in the XML
for each (var item:XML in xml.items.item) {
//Create a new menu item
var menuItem:MenuItem = new MenuItem();
//Calculate the starting angle for the menu item
var startingAngle:Number = angleDifference * count;
//Set a "currentAngle" attribute for the menu item
menuItem.currentAngle = startingAngle;
//Position the menu item
menuItem.xpos3D = 0;
menuItem.ypos3D = radius * Math.sin(startingAngle);
menuItem.zpos3D = radius * Math.cos(startingAngle);
//Calculate the scale ratio for the menu item (the further the item -> the smaller the scale ratio)
var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
//Scale the menu item according to the scale ratio
menuItem.scaleX = menuItem.scaleY = scaleRatio;
//Position the menu item to the stage (from 3D to 2D coordinates)
menuItem.x = vanishingPointX + menuItem.xpos3D * scaleRatio;
menuItem.y = vanishingPointY + menuItem.ypos3D * scaleRatio;
//Add a text to the menu item
menuItem.menuText.text = item.label;
//Add a "linkTo" variable for the URL
menuItem.linkTo = item.linkTo;
//We don't want the text field to catch mouse events
menuItem.mouseChildren = false;
//Assign MOUSE_OVER, MOUSE_OUT and CLICK listeners for the menu item
menuItem.addEventListener(MouseEvent.MOUSE_OVER, mouseOverItem);
menuItem.addEventListener(MouseEvent.MOUSE_OUT, mouseOutItem);
menuItem.addEventListener(MouseEvent.CLICK, itemClicked);
//Add the menu item to the menu items array
menuItems.push(menuItem);
//Add the menu item to the stage
addChild(menuItem);
//Assign an initial alpha
menuItem.alpha = 0.3;
//Add some blur to the item
TweenMax.to(menuItem,0, {blurFilter:{blurX:1, blurY:1}});
//Update the count
count++;
//Add an ENTER_FRAME listener for the animation
addEventListener(Event.ENTER_FRAME, moveCarousel);
//This function is called in each frame
function moveCarousel(e:Event):void {
//Calculate the angle speed according to mouseY position
angleSpeed = (mouseY - stage.stageHeight / 2) * 0.0002;
//Loop through the menu items
for (var i:uint = 0; i < menuItems.length; i++) {
//Store the menu item to a local variable
var menuItem:MenuItem = menuItems[i] as MenuItem;
//Update the current angle of the item
menuItem.currentAngle += angleSpeed;
//Calculate a scale ratio
var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
//Scale the item according to the scale ratio
menuItem.scaleX=menuItem.scaleY=scaleRatio;
//Set new 3D coordinates
menuItem.xpos3D=0;
menuItem.ypos3D=radius*Math.sin(menuItem.currentAngle);
menuItem.zpos3D=radius*Math.cos(menuItem.currentAngle);
//Update the item's coordinates.
menuItem.x=vanishingPointX+menuItem.xpos3D*scaleRatio;
menuItem.y=vanishingPointY+menuItem.ypos3D*scaleRatio;
//Call the function that sorts the items so they overlap each other correctly
sortZ();
//This function sorts the items so they overlap each other correctly
function sortZ():void {
//Sort the array so that the item which has the highest
//z position (= furthest away) is first in the array
menuItems.sortOn("zpos3D", Array.NUMERIC | Array.DESCENDING);
//Set new child indexes for the item
for (var i:uint = 0; i < menuItems.length; i++) {
setChildIndex(menuItems[i], i);
//This function is called when a mouse is over an item
function mouseOverItem(e:Event):void {
//Tween the item's properties
TweenMax.to(e.target, 0.1, {alpha: 1, glowFilter:{color:0xffffff, alpha:1, blurX:60, blurY:60},blurFilter:{blurX:0, blurY:0}});
//This function is called when a mouse is out of an item
function mouseOutItem(e:Event):void {
//Tween the item's properties
TweenMax.to(e.target, 1, {alpha: 0.3, glowFilter:{color:0xffffff, alpha:1, blurX:0, blurY:0},blurFilter:{blurX:1, blurY:1}});
//This function is called when an item is clicked
function itemClicked(e:Event):void {
//Navigate to the URL that's assigned to the menu item
var urlRequest:URLRequest=new URLRequest(e.target.linkTo);
navigateToURL(urlRequest);Hi Ned thanks for the reply,
Ok so I have a button in my main movie that loads the external swf
stop();
var my_loader:Loader = new Loader();
var my_btn:Button = new Button();
var my_pb:ProgressBar = new ProgressBar();
my_pb.source = my_loader.contentLoaderInfo;
my_btn.addEventListener(MouseEvent.CLICK,startLoading);
function startLoading(e:MouseEvent):void{
my_loader.load(new URLRequest("carousel.swf"));
addChild(my_pb);
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishloading);
function finishloading(e:Event):void{
addChild(my_loader);
my_loader.addEventListener("killMe",
killLoadedClip);
removeChild(my_pb);
function killLoadedClip(e:Event):void {
my_loader.removeEventListener("killMe",
killLoadedClip);
my_loader.unloadAndStop();
removeChild(my_loader);
Then I have a button in my loaded swf that closes the loader
This is spread over 2 frames
Frame1
function closeIt(e:MouseEvent):void {
parent.dispatchEvent(newEvent("killMe"));
Frame 2
back_btn.addEventListener(MouseEvent.CLICK, closeIt);
Frame 2 also holds all the code for the carousel
Thanks for your time and help in advance people ; ) -
I've created a 'plugin' SWF file in CS3 using actionscript 3.
The purpose of this file is to be included as a postroll in the
open source flash media player JW FLV/Media Player (
http://www.jeroenwijering.com/?item=JW_Media_Player).
I have heavily customized the media player libraries to do
various new things/alter how things worked, and now want to be able
to include the SWF file within this into a child sprite/movie clip.
HOWEVER, the problem lies in that the media player is written
completely in AS2, and therefore I have to use the MovieClipLoader
class to load in the SWF. Updating the source to AS3 isn't an
option unfortunatly, and downgrading the AS3 SWF to AS2 isn't an
option either, mainly due to the fact I've learnt AS3, not AS2, and
find it frustrating trying to find the AS2 equivalent to the AS3
methods I know.
The problem though lies in that MovieClipLoader does not like
my SWF at all. Initially I was presented with a load of sandbox
errors from when it was loaded in, which I then resolved so that no
security errors are produced. However, whenever I load in the clip,
the target sprite/clip is empty. I have gone through checking that
no errors occur on load, and it reports that the loaded SWF has
been initialized, yet I see nothing. Also, the code loading the SWF
is not at fault as it loads any other SWF (even another AS3 SWF
which just creates a rectangle) no problem.
Oddly enough, using the MovieClip.loadMovie method works in
one situation - when you load it into the root of the AS2 file.
When loading it into an empty movie clip, the same problem of a
blank clip occurs. The problem is not specific to the media player
either, as it happened in any AS2 file where I was testing how to
load in the AS3 SWF.
If it is of any use, the sandbox errors produced by the AS3
file when loaded into AS2 swf I had to resolve where to do with
stage access for getting the stage height and width, and a
Loader.content error when pulling out the BitmapData. These were
resolved via setting the allowed domains policy and eliminating any
reference to stage.stageHeight/With.
Does anyone have any ideas on how to solve this? The only
possible solution I've been able to think of so far since the AS3
swf won't display is to play with the LocalConnection class as
tests showed I can communicate between the AS2 and AS3 files, but
this would have to be a last resort, and is less than ideal when
there can be multiple instances of the player running (I would need
to use unique connection names for each instance so as to prevent
player A interacting with player B, and also as only one of the
players can listen on the connection at once).I have the component in the top level also,
I get this error:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\BaseButton.as:615]
at fl.controls::LabelButton/draw()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\LabelButton.as:724]
at fl.core::UIComponent/drawNow()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1343]
at fl.controls::List/drawList()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\List.as:594]
at fl.controls::List/draw()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\List.as:474]
at .tree::TreeList/draw()
at fl.core::UIComponent/callLaterDispatcher()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1532]
I've checked the definitions for the tree component,
The LabelButton and List I don't have much control over.
I'm not sure how to fix this. The xml is correct and loads easily if it's in the root document.
The list component doesn't load the labels, It stops on the first one.
What do I do next? -
How to effectively remove a loaded SWF from the stage?
I can not figure out a proper coding to remove a loded SWF from the stage.
Here is my set up.
I have a layout segmented into labeled section. In the section labeled "products" I have a layout consisting of product images acting as buttons which bring a user to another labeled section "prdctsPopUps"
In the "prdctsPopUps" section I have placed an instance of LoaderMax placed into an mc container. Placing LoaderMax into an mc container automatically resolved an issue of clearing loaded SWFs from stage when I come back to "products" section.
I specified the variable in the "products" section with the following set up:
var sourceVar_ProductsPopUps:String;
function onClickSumix1PopUp(event:MouseEvent):void {
sourceVar_ProductsPopUps="prdcts_popups/sumix1-popup_tl.swf";
gotoAndPlay("prdctsPopUps");
So each button has its own "....swf" URL and they all open fine and I can come back to "products" section without any issues.
However inside the swf (which loads through LoaderMax which is placed into an mc) there are other buttons which bring a user to labeled section "xyz". Which also functions properly. It opens as it is supposed to be and without any previously loaded "...swf" on the stage.
At the labeled section "xyz" there is a limited set of buttons repeating from section "products" which has to bring a user back to the same set up in the "prdctsPopUps" labeled section and open a corresponding "...swf" .
However only the last opened "...swf" will appear in that section. Effectively the one which was originally opened from the "prdctsPopUps" section and not the one which was supposed to be opened from the "xyz" section.
I can not understand why it would work from one labeled section and not from another. I can not figure out on which section which code/function needed to be placed.
Here is the set up from a button from the "xyz" section whcih supposed to bring a user to the same "prdctsPopUps" section but to load a different "...swf"
var sourceVar_ProductsPopUps_fromXYZ:String;
function onClick_floralytePopUp_fromXYZ(event:MouseEvent) :void {
sourceVar_ProductsPopUps_fromXYZ="prdcts_popups/floralyte-popup_tl.swf";
gotoAndPlay("prdctsPopUps");
Here is the code set up for the LoaderMax from the "prdctsPopUps" section:
var loaderProductPopUps:SWFLoader = new SWFLoader(sourceVar_ProductsPopUps,
estimatedBytes:5000,
container:holderMovieClip,
onProgress:progressHandler,
onComplete:completeHandler,
centerRegistration:true,
alpha:1,
scaleMode:"none",
width:540,
height:730,
crop:true,
autoPlay:false
function progressHandler(event:LoaderEvent):void{
progressBarPopUp_mc.gradientbarPopUp_mc.scaleX = loaderProductPopUps.progress;
function completeHandler(event:LoaderEvent):void{
var loadedImage:ContentDisplay = event.target.content;
TweenMax.to(progressBarPopUp_mc, 1.5, {alpha:0, scaleX:0.25, scaleY:0.25});
loaderProductPopUps.load();
Is there something which needs to be imported, or specific function needs to be specified in a specific labeled section?actually, i think you'll need to use something like:
var loaderProductPopUps:SWFLoader;
if ((loaderProductPopUps){
if(loaderProductPopUps.content)){
loaderProductPopUps.unload();
loaderProductPopUps= new SWFLoader(sourceVar_ProductsPopUps, //the value of sourceVar_ProductsPopUps allows to load mulitple SWFs from the products page.
estimatedBytes:5000 ,
container:holderMov ieClip,// more convinient and easier to manage if to place the LoaderMax into an empty mc (holderMovieClip)
// if not will work as well. Then the line container:holderMovieClip, has to be replaced with container:this,
// can be any size, can not be scaled as it distorts the content
onProgress:progress Handler,
onComplete:complete Handler,
centerRegistration: true,
//x:-260, y:-320, //no need for this is if used: centerRegistration:true,
alpha:1,
scaleMode:"none",
//scaleX:0, scaleY:0,
//vAlign:"top",
width:540,
height:730,//scales proportionally but I need to cut off the edges
crop:true,
autoPlay:false
function progressHandler(event:LoaderEvent):void{
progressBarPopUp_mc.gradientbarPopUp_mc.scaleX = loaderProductPopUps.progress;
function completeHandler(event:LoaderEvent):void{
var loadedImage:ContentDisplay = event.target.content;
//TweenMax.to(loadedImage, 1.5, {alpha:1, scaleX:1, scaleY:1});//only need this line if corresponding values are changed in SWF loader constructor
TweenMax.to(progressBarPopUp_mc, 1.5, {alpha:0, scaleX:0.25, scaleY:0.25});
loaderProductPopUps.load();
Maybe you are looking for
-
How to download adobe creative suite 4 without disc (mac)?
how/where can i download adobe creative suite 4 without the disc? the disc drive on my mac is broken
-
I purchased an itunes song. It was on my iphone, but not on my itunes or my computer? Where is it? how do I find it? If I deleted it from my iphone is it gone forever?
-
CASE vs DECODE - CASE with SUM and All in Page Item is non aggregable
Hi, I'm using Discoverer 9.0.4. After switching calculations from DECODE to CASE I found out that case gives a non aggregable result when using a Page Item and selecting <All>. The calculations (SUM x) / (SUM y) or (x SUM) / (y SUM) where x and y are
-
HTML5 audio with Shoutcast - invalid source
I have been trying to make the <audio> tags work with Shoutcast broadcasts in IE11 and have been unsuccessful after trying numerous things I have found on the web. It works fine with Chrome, FireFox, and in various Android browsers, but consistently
-
Hi! I need help on RH x5 index. Here's the problem: After indexing about 75% of the files in the project, I tried to publish and everything's working fine. After I indexed all of the files, everything's messed up. My primary layout is WebHelp. The fi