ActionScript 3.0 :: DisplayObject.alpha On MouseEvent?
Mar 24, 2010
I have a button (VehiclesButton) which on rollover I want it to trigger a mouse event so an image(VehiclesCentral) to the side of it (I've just set the alpha to 0 so its invisble, but its on the stage) will have its alpha increased to 100 and become visible
VehiclesButton.addEventListener(MouseEvent.MOUSE_OVER,test);
function test(e:MouseEvent):void
{ VehiclesCentral.DisplayObject.alpha = 100 ();}
When I publish this though I get no compiler errors, only an error when I actually go onto it and rollover the button.I get the following error message: TypeError: Error #1006: value is not a function. at QualityPortal_fla::MainTimeline/test()
(Quality Protal_fla is the file name I am working on).
View 4 Replies
Similar Posts:
Nov 6, 2010
I have several stage event handlers to enable mouseovers over several dynamically generated moviecilps on the stage that then change their alpha to indicate the mouse is over that particular mc... fairly trivial (mcOver handler). Additionally, I also want to know what MC is clicked, so I update a public variable (public var activemc:Number) with the ID of the dynamic movieclip when the mouse is over it (using a hitTest to check, which is why the EventListener is added to stage and not to the MC), which is checked in the mcClicked handler:This is in the constructor:
//stage.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);
//stage.addEventListener(MouseEvent.MOUSE_UP, stopDrawing);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mcOver);[code]....
However, the mouseover behaviour (alpha 0 when over, alpha 1 when out) stops working as soon as I click on any movieclip on the stage, and the mcClicked ID checking (below) stops working completely. I don't know if this is to do with focus:
private function mcClicked(event:MouseEvent):void {
myTextField.text = String(activemc); // activemc is a public var:Number with the movieclip //ID
}
I then tried adding the event handler for the stage mouse_move again and this gets the mouseover working again but only for 1 more click, after which it stops again:
private function mcClicked(event:MouseEvent):void {
myTextField.text = String(activemc); // activemc is a public var:Number with the movieclip //ID
stage.addEventListener(MouseEvent.MOUSE_MOVE, mcOver);
View 1 Replies
Jul 9, 2009
I have a MovieClip (call it base_mc) which is under a bunch of other MovieClips (call them subclips). The MovieClips on top are all mouseEnabled with MOUSE_OVER, CLICK, etc, event handlers. I want to capture the event of MOUSE_OVER (or ROLL_OVER) on the base_mc as well. Any time I am over one of the subclips I am also over the base_mc clip. How can I capture this event?
View 2 Replies
Oct 21, 2010
I'd like to know what is the difference between MouseEvent.CLICK & MouseEvent.MOUSE_DOWN. Because when i use MouseEvent.MOUSE_DOWN for a button to set full-screen view its doesn't work, instead of this MouseEvent.CLICK works. So what was the reason.
View 3 Replies
Nov 6, 2010
I'm making a button for the first time, and I wanted to use a full click to drive it. However, when I use addEventListener(MouseEvent.CLICK, onClickHandler); nothing happens when I click on it. When I use (with the rest of the code being identical) addEventListener(MouseEvent. MOUSE_ down, onClickHandler); it works like a charm.
View 6 Replies
Apr 7, 2009
What is the difference between MouseEvent.MOUSE_UP and MouseEvent.CLICK? Why should I use one of these over the other?
Code:myButton_btn.addEventListener(MouseEvent.MOUSE_UP, fNavigate, false, 0, true);
myButton_btn.addEventListener(MouseEvent.CLICK, fNavigate, false, 0, true);
View 3 Replies
Aug 11, 2011
I have a MOUSE_DOWN handler that creates a CLICK event listener on a child object. Naturally, as soon as you release the mouse button, if you happen to be over the child object, the CLICK event fires.I was disappointed to discover that event.stopImmediatePropagation doesn't interrupt the CLICK event from registering the MOUSE_DOWN as part of its detection cycle. It makes sense that it doesn't but still... disappointing.A MouseEvent.CLICK consists of detecting a MOUSE_DOWN on the object and then if it's followed by a MOUSE_UP without leaving the object, he event fires. I had hoped that by cancelling the MOUSE_DOWN event, it would clear that out of the CLICK buffer, but no such potatoes, alas.This could all be handled with a flag and a couple more MOUSE_UP and MOUSE_DOWN handlers, but dang, smacks of effort
View 2 Replies
Oct 26, 2010
I would like to be able to quickly check if a given DisplayObject is a descendant (not in the inheritance sense - ie. child, grandchild, great-grandchild, great-great-grandchild, etc.) of another DisplayObject. There doesn't seem to be a native way to do this and I can only think of two ways to achieve it: Create the mother of all nested loops. Seems a bit, I dunno, wrong? Dispatch a bubbling event at the 'child' and check if the potential 'parent' receives it.
[Code]...
View 2 Replies
Jul 24, 2009
I have the following:
rwBtn.addEventListener(MouseEvent.MOUSE_OVER, audioOver);
function audioOver(e:MouseEvent):void
{
var thisClip:MovieClip = e.relatedObject;
thisClip.alpha = 0;
}
I would like to change the alpha of the clip that is being rolled over. I don't know how to target the clip that is being rolled over. How do I do that?
View 3 Replies
Oct 23, 2010
[URL] i want the object to fade out but in the object there's a lot of overlapping pictures and each becomes half transparent. how to make the movieclip to change the alpha as it was without objects?
[Code]....
View 2 Replies
Dec 15, 2011
just spotted this curious trick. If you want to flip something to go invisible on a click, and then reappear on another click (etc etc), try this:
create the sprite, setting alpha to either to 1 OR -1
mySprite.alpha=1; //OR
mySprite.aplha=-1;
[code]....
View 9 Replies
Jun 27, 2003
using AS, on loading a movie a solid shape is there with alpha at 100% then over a period of 5 secs its alpha is reduced to 0.
i'm new to this......please help if you want to if you don't have a good weekend but think of me struggling onwards and upwards...
View 14 Replies
Aug 2, 2011
I want to do aplpha = .5 for the whole app, but then have a MC display at full alpha, is there any way to do this?
View 6 Replies
Jul 28, 2011
What's difference between "$event:MouseEvent" and "e:MouseEvent". What do they do?
View 4 Replies
Jul 27, 2011
What does "$" means in actionscript 3? What's the difference between "$event:MouseEvent" and "event=MouseEvent"?
View 2 Replies
Feb 26, 2005
As far as I know theres in no way to cahnge the alpha of a dynamic text box. I put one in a movie clip and when i try to change the alpha of it everything else in it changes its alpha but the not the DT box. Could someone plz verify for me that u can't change alpha and help me find a component that allows alpha control with a dynamic text box. thx in advance.
View 5 Replies
Apr 8, 2010
I've come across a pretty bizarre bug in my code when working with level generation in a side-scrolling platformer I'm trying to make... I've been desperately trying to debug it for the past 2 days! I have a movieclip (exported for AS) called Section1, that contains the first section for a level. It's basically a huge movieclip containing other movieclips; this Section1 movieclip contains the graphics for the level, as well as collision detection (the graphics are .pngs converted into movieclips, the collision detection is transparent rectangles converted to movieclips). FYI, it's a BIG movieclip... roughly 3400 pixels wide.
So, since it is the 1st section of a level, I have it spawn at the beginning of the game. However, I need to access all the platforms, walls, and graphics inside section1 from inside AS. So, here's the code I am using to do this:
public var s1:Section1;
public var platforms:Array, walls:Array, levelGraphics:Array;
...
// in Main's constructor now:
s1 = new Section1(2236, 8);
[code]....
Initially, it works... I've traced the data in the arrays in my update method (run every frame), and I can see that the arrays contain displayobjects... for a split second, that is. Seemingly out of nowhere, the values for all the elements in the arrays become NaN! I think to myself... of course these DisplayObjects are "not a number"... they're displayobjects! Of course, this renders my arrays useless, since I can no longer access the data I need to do collision detections!
View 5 Replies
Oct 13, 2011
I can rotate it, or modify>transform>rotate +/- value
but what is the manual equivilant to simply object.rotation=0;
View 4 Replies
Aug 25, 2010
I linked a button to a .php file, but now i have the problen that if I try to do it again, I get an error : 1021 Duplicate function definition
ActionScript Code:
myButton.addEventListener(MouseEvent.CLICK, onClick);
function onClick(evt:MouseEvent):void
[code]......
View 1 Replies
Sep 4, 2008
I have 2 sprite which I create near the beginning of my video application. A bg and screenOverlay. On the first load of the file all is good but when I navigate away and then return to the swf my bg and screenOverlay do not get added to the displayList. I have a example up here at [url]...
View 9 Replies
Feb 8, 2010
I have array with DisplayObjects and I need exactly copy of my current array with same DisplayObjects but each DisplayObject should not have direct and indirect relation with my current array. Do you have any clue about this coping display Object.
View 2 Replies
May 19, 2010
I have this class:
public class IskwabolText extends Sprite {
private var _tf:TextField;
private var _tfmt:TextFormat;
[code].....
View 2 Replies
Jun 5, 2011
I'm trying to load a module and add it to a mx:box object called "mod". [code]...
View 1 Replies
Jun 29, 2011
I know how to draw a rectangle and add it to a DisplayObjectContainer,but do you see a simpler method to directly add a border to a DisplayObject? DisplayObject don't seem to have addChild(), so I would have to add it on the parent, which is not perfect in my opinion...
View 3 Replies
Oct 18, 2011
I have a grid of DisplayObjects that when I put a glow on any of them, the glow overlap the other objects.
I was wondering if I could take the glow created by a DisplayObject and put it another, so I can attach it to a container that's behind all the objects?
View 2 Replies
May 19, 2009
I am trying to understand the interaction between Flex UIComponents and (Flash?) DisplayObjects... But it's not clear to me what the UIComponent class "adds" to DisplayObject. So, what can a UIComponent do that a DisplayObject cannot?
View 2 Replies
Dec 31, 2009
ActionScript Code:
mc.addEventListener(MouseEvent.CLICK,clic);
function clic(evt:MouseEvent){
var clip:MovieClip=evt.target as MovieClip;
removeChild(clip);
}
1) Why it's also possible write removeChild(DisplayObject(clip)) and for what? In which case it's necessary?
2) if I write var clip=evt.target it's works too but if I write var clip:MovieClip=evt.target it doesn't work. Why? It's a movieClip that should go in the variable var.
View 4 Replies
Aug 16, 2010
I am trying to store data in an object about different objects, but right now i am using their names. This was working at first but if I have 2 movieclips of the same class (from the library), then their children will both have the same names and this messes with my data storage.
View 5 Replies
Apr 8, 2009
I'm trying to get the same effect as thiI'm almost ready to complete it but I get this warning and my script crashes."Warning: 3D DisplayObject will not render. Its dimensions (4278, 3977) are too large to be drawn."To make this kind of effect I use the rotationX function and when I zoom in I tween the "z" property. I dynamically generate all thumbnails and show them as a grid using some XML data.
View 2 Replies
Dec 27, 2009
i'm looping though a display object and trying to reset some button. the issue i'm having is i'm getting and error:1119: Access of possibly undefined property menuText through a reference with static type flash.displayisplayObject.on the line where i try and target obj.menuText below. the weird thing is that this same code works when the actionscript isn't in a document class. i think i'm importing all the classes i need. also in the document class i had to add the MovieClip(obj) as pointed out below or i'd get an error similar to the one about.why moving this into a package is causing this?
public function resetMenu() {
//Loop through all of the menu itemsd
for (var i:int=0; i<menuHolder.numChildren; i++) {
[code].....
View 2 Replies