SEARCH YOUR SOLUTION HERE  

Same base class for two different child classes in different swfs

,

Following is my code of base class :

Code: public class Application extends Sprite { private static var instance:Application; public function Application() { instance = this; } private function showBlurLayer(flag:Boolean):void { //some code here... } public static function showBlurLayer(flag:Boolean):void { instance.showBlurLayer(flag); } } swfA ==> Document class
Code: public function SWFA extends Application { //FLV player code goes here... } swfB ==> Document class
Code: public function SWFB extends Application { public function SWFB() { addEventListener("addedToStage", addedToStageHandler); } private function addedToStageHandler(e:Event):void { Application.showBlurLayer(true); var media:Media = new Media() addChild(media); } } SWFB ==> Media class
Code: public class Media extends Sprite { public function Media() { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener("complete", completeHandler); var closeBtn:Button = new Button(); closeBtn.label = "Close"; closeBtn.addEventListener("click", closeClickHandler); addChild(closeBtn); } private function closeClickHandler(e:MouseEvent):void { Application.showBlurLayer(false); this.visible = false; } private function completeHandler(e:Event):void { addChild(loader); } } ---------------------------------------

So the problem here is when I call Application.showBlurLayer(true), it works fine (actually it applies blur filter). But after the swfA is loaded correctly, and when I click on "Close" button and call Application.showBlurLayer(false), it does not work.

Can some one help in this matter

Thank you,
Naresh

Posted On: Thursday 25th of October 2012 09:44:18 PM Total Views:  309
View Complete with Replies




Related Messages:

Help web site and authouring flash dont work the same cant get intro working   (125 Views)
www.scareymakeup.com I have made this Flash website my first one, a university project. Only it has two scenes. It starts in scene 1, is supposed to jump to scene 2, to show an animated intro then go back. to scene 1. The way this is done is on frame 2 of the flash site the script key frame then gotoAndPlay("Scene 2", "IntroStart"); then key frame, them you have key framed labled home 2 so at the end of the intro (on the skip button has the scropt gotoAndPlay("Scene 1", "Home2"); Now here is the kicker... both the swf and index file do this locally on my computer but not on the uploaded website it just pauses then jumps straight to home to and starts the main site skipping the 'diversion' How do I get it to go to the intro on the web (where some poor kittens meet an unfortunate end) so i have the animation demo as well and the site. Ie its supposed to start, find the divert script, do the animation movie then return a bit ahead to the menu not skip to the menu
CS3 Two Banners Synch to start at same time   (96 Views)
I have been trying to synch two different banners on a HTML page. I have checked this link :: http://adspecs.yahoo.co.uk/guidelines/technical/lc But I am not sure if the localconnection is needed for what I am trying to achieve.
Get URL AS2 in same window.   (174 Views)
Hi I'm stumped! Just getting back into flash after a long break and im seeing that my old AS2 code no longer works in web browser for some reason. Something so simple has me banging my head against the wall. I simply want to have a button get url in the same window the .swf is already in. I have tried many different methods and am now needing to ask for assistance. The following is for 5 buttons I have modified each line to be different. They all open in new tabs and the 4th doesnt work at all. I am using CS3 and AS2 Actionscript Code: btn2.onRelease = function(){ getURL("http://myurl.htm", _blank);};btn1.onRelease = function(){ getURL("http://myurl.htm", "_blank");};btn3.onRelease = function(){ getURL("http://myurl.htm", _self);};btn4.onRelease = function(){ getURL("http://myurl.htm","_self");};btn5.onRelease = function(){ getURL("http://www.myurl.htm", _blank);}; I am using the flash on a simple html site. I am adding the flash to the site with dreamweaver. Please Help My Site Please note the links in the flash will direct you to error 404 as i have not yet made them.
i want the same code as .as file with oop functionality   (99 Views)
HI , please help me in this I am a new bie . I created a .fla file with action script inbuild. i want the same code as .as file with oop functionality. code in action frame: Code: var clicks=0; var tri:triangledraw = new triangledraw(); function drawtri() { if(clicks>=3) var t:MovieClip = createEmptyMovieClip("triangle", 1); t.beginFill(0x0066cc); //draw a triangle t.lineStyle(2, 0x000033, 100); t.moveTo(a1, b1); t.lineTo(a2, b2); t.lineTo(a3, b3); t.lineTo(a1, b1); t.endFill(); t._x = 0; t._y = 0; } trace (a1); onMouseMove = function(){ if(dragging==1) { a1=_xmouse; b1=_ymouse; } if(dragging==2) { a2=_xmouse; b2=_ymouse; } if(dragging==3) { a3=_xmouse; b3=_ymouse; } drawtri(); } onEnterFrame = function(){ drawtri(); } onMouseDown=function() { clicks++; switch(clicks) { case 1: a1=_xmouse; b1=_ymouse; { createEmptyMovieClip("c1", 2); // center point and radius of circle var r:Number = 5; var x:Number = a1; var y:Number = b1; // constant used in calculation var A:Number = Math.tan(22.5 * Math.PI/180); // variables for each of 8 segments var endx:Number; var endy:Number; var cx:Number; var cy:Number; c1.beginFill(0xff0000); c1.moveTo(x+r, y); for (var angle:Number = 45; angle
menu items open in same window? hand cursor?   (90 Views)
Can someone tell me why these menu items won't open the specified url's in the same window (won't open them at all) And why is there no hand cursor (like normally when you mouse over a link) See the .fla attached and much
MX04 Lots of things same command- how?   (117 Views)
I've got 10 boxes on the stage. I want to start and stop dragging them all when needed. Do I have to type in boxone.onPress=function(){ startDrag(this); } etc for ALL of them individually or can I assign the same commands to all 10 boxes just the once - it would save a lot of typing! Huw
Syncronizing three sperate SWF's to load at the same time   (79 Views)
I currently have three separate swf files embedded into an html page. They do not have any loading functions at this time, but I really need to find a way to have them all preload and start at the same time. I'm using leftside.swf, mid.swf and rightside.swf Any thoughts on this would be greatly appreciated.
Stream.Time returning same timestamp   (87 Views)
Hi! I am struglling to find any solution for the below problems : 1. When using Stream.time in actionscript server side, sometimes it returns the same timestamp. why it is returning the same output and any solution for the same. 2. When I am unpublishig the stream then re-publishing the unpublished stream timestamp does not get to reset to 0. I want to restart with 0 timestamp. Please anyone help me out on this.
Keeping the same instance name, but changing the object.   (110 Views)
, I've got a frame of code with two boxes on the stage. If you click on of them, it runs this code: ActionScript Code: charSelect=1; and if you click on the other box it runs this code: ActionScript Code: charSelect=2; Now, on my main frame of code, I've got an init() function which runs all the initialise commands. It includes this: ActionScript Code: function init() //Loads assets to the stage and starts animations { if (charSelect == 1) { character.addChild(character); } if (charSelect == 2) { characterFemale.addChild(character); } } These functions basically let you select which character is loaded to the stage with the instance name 'character'. my control code is written in relation to the instance name 'character'. However, after I've clicked the box which selects which character to load to the screen, I get this error message: ActionScript Code: Scene 1, Layer 'Layer 1', Frame 2, Line 1551061: Call to a possibly undefined method addChild through a reference with static type Class. I'm really new to Flash so I'm not completely sure what's wrong If you could explain to someone as if they've never touched flash before that would be brilliant.
Reload FlV in same position?   (85 Views)
, I am making my own video player and am adding an SD/HD feature which will basically be moving to a replica page with the relevant definition video on it. I was wondering if it is possible to have it so when this is done, and the new frame loads the FlV will load at the same position as the previous one when the button was pressed So like a ActionScript Code: currentFrame but for an Flv
How can I use the same code for many mcs?   (103 Views)
I wish to make a salt particle move across the screen I know how to do this but I have many salt particles and i need them to all move across the screen when the 'start' button is pressed. function GenerateSalt () { salt_no = SaltStepper.value; for (count+ 1; count < salt_no; count=count+1){ Position_y = Math.random () * 125 + 5 _root.attachMovie("Salt_mc", "Salt", 1, {_x: 790, _y: Position_y}); _root.Salt.duplicateMovieClip ("Salt" + count, count); } } Can someone help me Thank you
Centering x amount of independant movieclips of same size - HOR and VERT   (91 Views)
Got x amount of independant movieclips on my stage, named btn1, btn2 etc... of them have the same size. What I want to do is, no mather what amount of movieclips I have, then center on ._x - im running my flash settings as full screen. What i've tried to do is, center all of the movieclips (which will put them on top of eachother)- and too lay them out next to eachother, then in a for loop do - var centerPosition+btn1._width. This works fine. However from here im a bit blank. Tried calculating the width of all the buttons next to eachother and divide that by 2 - that gets me close, but no cigar. A thing to note, registration point for my movieclips is top left. Any suggestions My effort below: ActionScript Code: Stage.scaleMode = "noScale"; Stage.align = "TL"; //Manually defining how many buttons I have var total:Number = 8; //VERT + HOR CENTER ALIGN var xTarget:Number = Stage.width/2-btn1._width/2; var yTarget:Number = Stage.height/2-btn1._height/2; function centerAlign() { //Too lay out buttons next to eachother I do xTarget=xTarget+btn1._width for (var b = 1; b
Open link in same window   (77 Views)
, Does anyone know how to make the URL open in the same window. I am using flash CS3, Is there anyone who can edit the script below to allow this. The instance name is Button6 var getnextpage5:URLRequest = new URLRequest ("http://www.yokubou.co.uk/digitalart.html"); Button6.addEventListener(MouseEvent.CLICK,b5Click) ; function b5Click(event:MouseEvent):void{ navigateToURL(getnextpage5); }
AS3 - help to stop video playing in same timeline   (211 Views)
I've just posted a reply in the ActionScript3 Forum as someone else has had the same problem, but I can't find a solution so posting again here just in case someone else can help as it's taken me about 5 hours of getting nowhere and I'm sure this is really easy... I have one frame on my time line called "theatre" and another called "Video" the buttons between the two work but the video continues to play in the background when I go back to the "theatre" frame on the same time line and I can't find a stop function that will work. A button on my main page links to Video on the timeline with following AS3 btnVid.addEventListener(MouseEvent.CLICK, clickbtnVid); function clickbtnVid(event:Event) :void { gotoAndStop("Video"); } And when the Video (which was built using the flvplayback component) plays there is a back button, which works but the video still continues to play, the AS3 is: btnBack.addEventListener (MouseEvent.MOUSE_DOWN, stopHandler); function stopHandler(evt:MouseEvent):void { gotoAndStop(1); } I really can't find the right solution for this, despite lots of attempts, so would really appreciate any help please...
changing colours on same animation   (117 Views)
firstly I want to introduce myself as I am new to the forums here. My name is Simon and am currently working as a 3d Graphic Designer. I look forward to learning a lot and hopefully being able to, eventually, give back to the community as well. I have run into a problem. My project is a washing machine constantly rotating (so the animation I have put onto a loop) This is fine but there are 2 different colours to the washing machine. The client wants to be able to click on the colour button on the left hand side and ,this is the tricky bit, while the animation is still rolling the washing machine changes its colour. Is this even possible It will probably end up being something really simple but flash isnt my thing and I just cant figure it out. Im using cs3 pro if that makes a difference.
Trouble in dueling with loader loading the same thing twice   (130 Views)
I have a background symbol that does the loading external jpg job, and a engine as3 that loops 2 backgrounds continuously on the screen. However, only one background can load file although they "new" from the same symbol. To test this urr... phenomenon, I exchange the order of "new" code of 2 backgrounds, then whichever on top will perfectly load the jpg file and the other will remain blank. has anyone faced this problem before or knowing how to solve it plz teach me. this external loading is really painful to me from the beginning. For the code: Background code var URLvar:URLRequest; var fBGLoader : Loader = new Loader( ); URLvar = new URLRequest( "background collection/fyrise/fyriseFront.png" ); fBGLoader.load(URLvar); this.addChild(fBGLoader); Engine code private var B1:fBG; private var B2:fBG; private var Container= new MovieClip(); BLen=2500; B2=new fBG(); B1=new fBG(); B1.x=0; B1.y=0; B2.x=B1.x-BLen; B2.y= B1.y; Container.addChild(B1); Container.addChild(B2); stage.addChild(Container); so as you can see, I put the B2 = new fBG() prior to B1=new fBG(), then I can see B2 but not B1 and if I exchange the order, I can see B1 but not B2. That's the problem!
multiple same keyCodes issue?   (178 Views)
duplicate
movie clip not same size as stage   (74 Views)
When i go to insert>new symbol and create a movie clip it is not the same size as the stage, so only a certain portion of it shows up when testing my scene. is there anyway to change the resolution of a movie clip
Using the same array again   (119 Views)
Hi kids, I'm having some trouble. I made multiple arrays of one array: var side1Array:Array = [1,+,1] for (var i:int = 0;i
When button is dragged button remains on same position (Need help!!!)   (93 Views)
I am using Flash CS5 with AS3 I have buttons on stage, I want when a button is dragged the button should remain on same position and a line from the right side of button should connect the tip of the mouse pointer and as we move the line will adjust it self at runtime. After releasing drag the line should disappear.