Smoother Increment On Alpha Property
This is my first ever question that I have posted to a forum. I normally spend hours battling with the simpliest AS and eventually work it out, but in this case I've decided to seek help.
Anyway, I've trying to run the following AS applied to a button:
on (rollOver) { i = getProperty(this.button01, _alpha); while (i<100) { if (i>100) { break; } setProperty(this.button01, _alpha, i++); } } on (rollOut) { i = getProperty(this.button01, _alpha); while (i<=100) { if (i<=50) { break; } setProperty(this.button01, _alpha, i--); } }
The action seems to work, however the increment is instant and I want to acheive a smoother transition. Any help appreciate.
Thanks
Simon
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 04-29-2004, 08:02 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Smoother Increment On Alpha Property
This is my first ever question that I have posted to a forum. I normally spend hours battling with the simpliest AS and eventually work it out, but in this case I've decided to seek help.
Anyway, I've trying to run the following AS applied to a button:
on (rollOver) {
i = getProperty(this.button01, _alpha);
while (i<100) {
if (i>100) {
break;
}
setProperty(this.button01, _alpha, i++);
}
}
on (rollOut) {
i = getProperty(this.button01, _alpha);
while (i<=100) {
if (i<=50) {
break;
}
setProperty(this.button01, _alpha, i--);
}
}
The action seems to work, however the increment is instant and I want to acheive a smoother transition. Any help appreciate.
Thanks
Simon
How To Increment The _x Property
The loop as follows :
Code:
subbuttonArray = myXml.firstChild.childNodes[i].childNodes;
for(n = 0; n<=subbuttonArray.length-1; n++){
trace(subbuttonArray[n])
subMenu = subbuttonArray[n];
var m =navigation.attachMovie( "sub_menuItem", "sub_menuItem"+n, n+100);
m.sub_nameTxt.text = subMenu.attributes.id;
m._x = k._x;
m._y = k._y - (m.box._height*n )-m.box._height;
m._visible= true;
m.onRelease = function(){
getURL(this.itemUrl, "_blank");
}
}
The trace result as follows :
Code:
<sub id="Logos" theURL="http://www.your.com" />
<sub id="Websites" theURL="http://www.your.com" />
<sub id="Coding" theURL="http://www.your.com" />
<sub id="Biograpy" theURL="http://www.your.com" />
<sub id="History" theURL="http://www.your.com" />
<sub id="AS Dictonary" theURL="http://www.your.com" />
<sub id="Kirupa" theURL="http://www.your.com" />
<sub id="Forum" theURL="http://www.your.com" />
var k was declared earlier.
The result is the last 3 array elements in the array shows on top of the rest element below it.
Can someone show me how to alter the loop so that m._x start from 0 and icrement accordingly?
Thanks
How To Increment Dynamic Clip Property?
I want to do something like this
setProperty("ball"+x, _y, ("ball"+x._y) + yspeed);
as if it where
ball1._y += yspeed;
but ball1 = ballx
x is a variable
Does anybody know how do do this?
or a work around?
Smoother AS Tween And Alpha
Hi folks,
I'm pretty new on AS so I got some probs.
How can I make this Tween smoother?
PHP Code:
_root.attachMovie("mc", "cloud", 100, {_alpha:0, _x:200, _y:400});
cloud.onEnterFrame = function(){
this._y-= 6;
this._alpha+= 2;
if (this._y <= 110) {
delete this.onEnterFrame;
}
};
It would be great if somebody could help me with that.
thx a lot.
Why Do Alpha Tweens Move Smoother In Flashplayer Than Browser
I just noticed the oddest thing.
when i play a flashanim in flashplayer (a tween setting something from 100 - 0 % alpha) it runs all smooth.
but when I play it in the f12 browser preview, it runs noticeably less smooth.
is this normal and why?
thanks
Why Do Alpha Tweens Move Smoother In Flashplayer Than Browser
I just noticed the oddest thing.
when i play a flashanim in flashplayer (a tween setting something from 100 - 0 % alpha) it runs all smooth.
but when I play it in the f12 browser preview, it runs noticeably less smooth.
is this normal and why?
thanks
anim written in flash5
player 5
browser Mx plugin
so...
Set Property Alpha
Ive got an instance (called "scherm") of an MC.
I want this MC set to alpha 20, when you rollover an object on the screen.
Why isn't this working?
on (rollOver) {
setProperty (scherm, _alpha, 20);
}
Instead of setting the alpha of SCHERM to 20, it sets the alpha of the OBJECT to 20
why is this?
[F8] Set Property : Alpha?
Hey there. I have this code set on a MC (with the instance name of songnotes).
So when you roll over the "button" the movie clip is visible, and when you roll out it is not.
the problem is that when you roll over it shows ok, but when you roll out, every thing on the stage goes to alpha 0 not just the MC in question.
Any ideas on how to fix this?
_root.track1.onRollOut = function():Void {
if (musicbuttn != track1) {
track1.gotoAndStop("start");
}
setProperty (songnotes, _alpha, 0);
}
Set Property: Alpha
Hey there. I have this code set on a MC (with the instance name of songnotes).
So when you roll over the "button" the movie clip is visible, and when you roll out it is not.
the problem is that when you roll over it shows ok, but when you roll out, every thing on the stage goes to alpha 0 not just the MC in question.
Any ideas on how to fix this?
_root.track1.onRollOut = function():Void {
if (musicbuttn != track1) {
track1.gotoAndStop("start");
}
setProperty (songnotes, _alpha, 0);
}
Set Property-Alpha Question
Hi All,
I want to create a button that when pressed changes its own alpha down to 50% and also starts the playing of a movie clip. When pressed a second time I want for the movie clip to play backwards and the alpha of the button to change back to 100%
Alpha Property Question
hi all
i was just wondering: i want to decrease (or increase, it doesn't matter) the _alpha property of a MC frame after frame with one and only appropriate script. do you have an idea?
for example, i tell the MC to play from frame 1 to 40. and in the same time, i want it's alpha property to decrease from 100% to 0%.
thank you for your answers :-)
Setting Alpha Property
How would I go about setting the alpha of an mc if a variable has been set?
In my main timeline (2 frame loop) I have
if (_level0.sectionname != "whoweare" && _level0.sectionname != undefined) {
setProperty ("/whoweare", _alpha, "50");
} else {
setProperty ("/whoweare", _alpha, "100");
}
but it doesn't work...what am I doing wrong?
Strange With Alpha Property
Hi!
I have this little code:
Code:
this.createEmptyMovieClip("bar", 1);
with (bar) {
beginFill(0xFF0000, 50);
lineStyle(0, color, 10);
moveTo(0, 0);
lineTo(0, 100);
lineTo(20, 100);
lineTo(20, 0);
lineTo(0, 0);
endFill();
_x = 100;
_y = 100;
}
bar.onRollOver = function() {
this._alpha = 100;
};
bar.onRollOut = function() {
this._alpha = 50;
};
Basicaly, this draw an rectangle, and fill with red color. Problem is with alpha property. When RollOver or RollOut, not have desired _alpha (100 respectively 50). I think i have only half of this value.
Where is the problem?
This code can be tested to verify this strange!
P.S. tested with flash 8 and mx2004
DataGrids And Their Alpha Property
I've been scouring the web for a way to make the background of the dataGrid component (which is added via AS3) more transparent. Has anyone figured this out?
It was easy when the component was dragged out onto the stage, but then some of the other properties aren't able to be customized.
Anyone?
Change Alpha Property Of A MC.
Hi!
Here I am again.This forum is very good.Thanks all for your help.
I have 3 MC with their background's alpha properties set to 0.
What I want is when I pass the mouse over each MC that one I have the mouse over gets its alpha property set to 35%.
Someone has told me to do this:
movie_mc.onRollOver = function () {
movie_mc._alpha = 35;
}
movie_mc.onRollOut = function () {
movie_mc._alpha = 0;
}
But everytime I pass the mouse over the MC even if the mouse is not over a button the cursor changes to a hand cursor.And when I put the mouse over a button inside this MC the alpha goes to 0 again.
Here is my project take a look at links www.eduardotavares.com.br/main.html
How do I do that?
How To Change The Alpha Property...
Hi!
I have 3 MC at my link section.Each one of them has a background (converted to a symbol) with alpha set to 0.I want that when I pass the mouse over each one the background gets its alpha property to 35 %.
How can I do that?
Here is the link so you can see what I am talking about:
www.eduardotavares.com.br/main.html and click link
Papervision 2.0 And Alpha Property
Hi,
Do you know how we can modify alpha parameters on Plane object with the new release of Papervision (2.0 alpha) ?
Previously, I was doing something like that :
Code:
plane.containers.alpha = 0.5;
But containers property disappeared from Plane object in version 2.0; I browsed every property of the new Plane object and couldn't figure it out.
Thanks for your help
Set Alpha Property With Fading Effect
Hi
I am just wondering if it possible to set the alpha property of a movie clip from 100% to 0% but gradually with a fading effect
thanks in advance
julien
Dynamic Text And Alpha Property
is it just me? but dymanic text dosn't seem subject to setting the _alpha property..even if the text is in a movie clip and you try setting that clips alpha, the text just shines through..any ideas?
thx
Alpha Property Of Dynamic Text Box
I am trying to set the alpha property of a movie clip with the following actionscript:
_root.movieclip._alpha = 20;
the problem I'm having is that the movie clip contains a dynamic text box and while the rest of the contents of the movie clip dim to the 20% alpha setting, the dynamic text remains at 100%.
Any thoughts on how to make the dynamic text dim as well would be greatly appreciated.
Thanks,
Brian
Text Instance And Alpha Property
Hi everybody:
I am trying to make "dissapear" an instance from flash5 actionscript, putting its alpha propierty into 0. But I have just found out that, when that instansce consist of text, nothing happens.
However, It turns into 0 easily manually, when I change the property from main panel.
Any suggestion?
Thanks in advance.
Change Alpha Property From Inside A Mc
I have a button inside a movie clip. I want this button, when clicked, to change the alpha value of a differect mc on the same scene.
When using the regular code for changing alpha value:
on (release) {
b1._alpha=100; (where "b1" is the name I gave the mc)
}
nothing happens.
Is it because I am not calling correctly the mc? what method should I use to call it?
Thanks, Efrat.
Gone Mad --alpha Property For Text Fields?
the book says you can do this but ... not sure what I am doing incorrectly. I have created a text field -- _root.createTextField("myField", 10, 20, 50, 200, 30);
but when I then add the code myField._alpha = 40 (or whatever value) it does nothing to the text field value. Im going mad, if anyone could shed some light, would be very greatful. ta k
Alpha Property For An Array Of Buttons.
I've got an array where I've stored button instance names. Such as:
buttonName=this._name;
buttonArray[x]=buttonName;
x++;
so everytime a different button is pressed it's added to this array. Now I have one button that when the user clicks on it, it needs to set all the alpha properties of the buttons in the array back to 100 (it's previously switched to 50 when the button is originally clicked on).
I'm having problems with this.. I've tried everything I can think of. I can't seem to just loop through my array and set them all. I imagine it's has something to do with how the array points to the button (or how i've assigned the button to 'this' earlier..just guesses tho). Anyways, any help would be appreciated. Thanks.
Problem With Setting Alpha Property
hi flashkit,
i have made a movie clip button & placed it in an mc (whoweare_menu) and i would like to set the alpha of another mc (events) to zero. I have used these 2 scripts but they don't work:
this._root.events._alpha("0");
this._root.events.setProperty._alpha("0");
any help is kindly appreciated.
Tks, intan
Apply Easing To ALPHA PROPERTY (help?)
Here is the code I am using. When I roll over (hover) the button, I still want it to glow, but have it ease from 0.0 to 0.8 then back to 0.0 when roll off. (The glow steadily gets brighter).
Anyone that can help show me what I am doing wrong would be greatly appreciated.
import flash.filters.GlowFilter;
var len:Number = 3
for (var i:Number=0; i<len; i++) {
var ref:MovieClip = this["st" + i]
ref.buttonMode = true;
ref.mouseChildren = false;
ref.addEventListener(MouseEvent.ROLL_OVER , rollMe)
ref.addEventListener(MouseEvent.ROLL_OUT, outMe)
}
function rollMe(e:Event = null) {
makeMeGlow(e.target as MovieClip);
}
function outMe(e:Event = null) {
stopMeGlow(e.target as MovieClip);
}
function makeMeGlow(who:MovieClip) {
var color:Number = 0x6caddf;
var alpha:Number = 0.0;
var targetAlpha:Number = 0.8;
who.alpha += (targetAlpha - who.alpha) * easing;
var blurX:Number = 20;
var blurY:Number = 20;
var strength:Number = 2;
var quality:Number = 3;
var inner:Boolean = false;
var knockout:Boolean = false;
var filter:GlowFilter = new GlowFilter(color, alpha, blurX, blurY, strength, quality, inner, knockout);
var filterArray:Array = new Array();
filterArray.push(filter);
who.filters = filterArray;
}
function stopMeGlow(who:MovieClip) {
who.filters = null;
}
stop();
Alpha Property Not Effecting Textfields
I have textfields which children of buttons. I cannot seem to get the textfields to be alpha 0. I can get all of their parents to be alpha 0. Why is this?
This would be the targeting from the maintimeline:
menuCont.indCont.btnCont.myButtonsAreHere
heres what I am using now from the maintimeline:
ActionScript Code:
var menuCont:MovieClip = new MovieClip();
this.addChild(menuCont)
function bsRollOver(event:MouseEvent):void {
//bs.ts = 150;
if (menuCont.getChildAt(1).alpha > 0) {
menuCont.getChildAt(1).alpha = 0;
} else {
menuCont.getChildAt(1).alpha = 1;
}
}
//next i call an instance of a menuClass I made
var m1:MenuDot = new MenuDot (mainTL.menuCont);
;
Error Defining Alpha Property
Would've thought this would be pretty basic but apparently I'm missing something here...
I'm trying to get a transparency map working in Flash from the alpha channel in a .TGA file. I'm using the following code:
asdf.alpha=1;
on a movie clip named 'asdf'. But I'm getting the compiler error "Access of undefined property asdf." What exactly is going wrong here?
While I'm on the subject in this thread, I can't figure out how to use an alpha channel as a transparency map over the RGB channels of the same file. Will the code I listed above do that?
Dynamic Manipulation Of Alpha Property
Code:
thumbs=["1.jpg","2.jpg","3.jpg"]//portfolio images
m = 20 // relative displacement
r = 4 // number of objects per row
count=16 // amount of objects total
h = r+(r*.25)
for (i=1; i<(count+1); i++) {
if(i >=(r+1)){xCord = (m*(i-((h+(r*2))-i)))+(Stage.width/2)}
if(i<(r+1)){xCord = (m*(i-(h-i)))+(Stage.width/2)}
if(i>=(r*2+1)){xCord = (m*(i-((h+((r*2)*2))-i)))+(Stage.width/2)}
if(i>=(r*3+1)){xCord = (m*(i-(((h+((r*2)*2))+(r*2))-i)))+(Stage.width/2)}
if(i>=(r*4+1)){xCord = (m*(i-(((h+((r*2)*2))+((r*2)*2))-i)))+(Stage.width/2)}
if(i<(r+1)){yCord = (Stage.height/2)-140}
if(i>=(r+1)){yCord = (Stage.height/2) - 100}
if(i>=(r*2+1)){yCord = (Stage.height/2)-60}
if(i>=(r*3+1)){yCord = (Stage.height/2)-20}
if(i>=(r*4+1)){yCord = (Stage.height/2)+20}
if(i>=(r*5+1)){yCord = (Stage.height/2)+60}
if(i>=(r*6+1)){yCord = (Stage.height/2)+100}
if(i>=(r*7+1)){yCord = (Stage.height/2)+140}
temp = mybox.duplicateMovieClip ("box"+i, i);
_root["box"+i].number=i;
_root["box"+i].gotoAndStop(i+1);
_root["box"+i]._x = xcord;
_root["box"+i]._y = ycord;
}
for(i=0;i<=count;i++){
contain.duplicateMovieClip("gallery"+i, i+40);
_root["gallery"+i].loadMovie(thumbs[i]);
_root["gallery"+i]._x= (((Stage.width/2)-60)+(i*20));
_root["gallery"+i]._y= (Stage.height/2);
_root["gallery"+i]._xscale = 15;
_root["gallery"+i]._yscale = 15;
_root["gallery"+i]._alpha = 0;
}
for (var i=0;i<=count;i++){
_root.attachMovie("mybox", "box"+i, _root.getNextHighestDepth(), {_x:i*30});
_root["box"+i].thei= i+1;
}
for (var i=0;i<=count;i++){
_root.attachMovie("contain", "gallery"+i, _root.getNextHighestDepth(), {_x:i*30});
_root["gallery"+i].i= i-1;
_root["box"+i].onRollOver=function(){
_root["gallery"+i]._alpha = 100;
}
_root["box"+i].onRollOut=function(){
_root["gallery"+i]._alpha = 0;
}
}
In short thumbs are images which are loaded onto the stage.
Then I have boxes which are meant to act like rollovers and dependent one which is rolled over I need the alpha to change from 0 to 100.
Since, all the images will be on the screen but, transparent, unless the button is rolled over in which makes one opaque.
I have everything set up and working besides for the dynamic application of the alpha property to each individual image.
particularly this piece of code(near the bottom):
Code:
_root["box"+i].onRollOver=function(){
_root["gallery"+i]._alpha = 100;
When I plug in a actual name for gallery this works.
For instance:
Code:
_root.gallery1._alpha = 0;
However, that makes it so any square you rollover the same image appears for each.
Therefor, I need to do it more so like I have for the box and base it on i.
Any help would be most appreciated
thanks
Alpha Property Not Working With Text
I have created a simple motion tween with a MovieClip created from a text phrase created in Flash and have tried to set the alpha index to got from 0% at the beginning of the tween to 100% at the end. Here is the problem, the tween works great, however the alpha value is not working AT ALL. It works with MovieClips created using jpg and png images imported into flash, however if I use text inside flash and convert that to a MovieClip it will not work. I am not using actionscript, I am only working with the timeline and property inspector. What is going on and why will this not work? I have searched the forum and it seems I am the only idiot who is having a problem like this. Can anyone please help me out? Also, I am using Flash 8.
Thanks!
Chuck
Sprites/Containers - Alpha Property
I have created a container for placing a number of objects and would like to globally set the alpha to 50%.
Why can't I just do:
container.alpha = 50;
(container is a sprite)
Any insight would be appreciated
Attach Code
import flash.display.*;
import flash.text.TextField;
import flash.text.*;
import flash.events.Event;
import fl.transitions.*;
import fl.transitions.easing.*;
// create container for the loading media message
var container:Sprite = new Sprite();
addChild(container);
container.x = 10;
container.y = 300;
var format:TextFormat = new TextFormat();
format.font = "Tekton Pro";
format.color = 0xFF0CCC;
format.size = 60;
var myText:TextField = new TextField();
myText.selectable = false;
myText.width = 1000;
myText.embedFonts = false;
myText.defaultTextFormat = format;
myText.text = "Loading media... please wait";
container.addChild(myText);
container.alpha = 50;
External Swf Load With Alpha Property = 0
I am loading an external swf into my main movie and setting its alpha = 0;
The problem is that only the picture inside swf stays invisible while dynamic text doesnt (it appears immediatelly).
SWF consists of 3 layers: transparent background, dynamic textfiled, and mask for text.
And I am loading swf into a movie clip on stage.
Anyone know why is this happening and how to fix it?
Otherwise I cant tween it..
Thank you!
Change Background Alpha Property
Hi!
Here I am again.This forum is very good.Thanks all for your help.
I have 3 MC with their background's alpha properties set to 0.
What I want is when I pass the mouse over each MC that one I have the mouse over gets its alpha property set to 35%.
How do I do that?
Alpha Property Change EMERGENCY
I am trying to create a frame based action where a when the timeline reaches a frame it goes to a mcInstance (ability) and goes to a frame label inside the mc(web) and then sets the alpha for the mc to zero and then fades up the alpha (like i would do with a regular tween)
how would something like that be coded?
R
Random Animation Of Alpha Property
Hi all, I've been racking my brain for way too long on how to do this and I'm not sure where to start anymore.
Here's what I want to do:
I have a movieclip called smoke_mc and using function I make it fade in. Once it is fully visible I'd like to have it randomly fade in and out at different rates using AS instead of tweens.
If anyone can point me in the right direction it would be greatly appreciated.
TIA.
Tweening Alpha Property With Tweener
Hi guys,
Got this code here that I'm trying to use to tween a movie clip in. However, when I add the alpha property to it, it just sets the alpha and doesn't tween it in over time.
Tweener.addTween(holder, {x: 200, y: 50, time: 2, transition:"easeOut"});
to
Tweener.addTween(holder, {alpha: .5, x:200, y:50, time: 2, transition:"easeOut"});
I looked in the tweener documentation and a couple other websites, but still haven't found how to do this yet. Anybody know?
Thanks.
Alex
PV3D 2.0, Tweener, Alpha Property
I am trying to tween the alpha of the content in a plane using papervision 2.0, Tweener, etc...
Clearly you can't tween the alpha of the plane...does anyone have ideas on that one?
Simple Alpha Property Change...not Working
I have a button clip with on(RollOver) assigned to it so that the alpha of another MC...in this case "target" is set to 100% from an original alpha state of 0%. For some reason I can't get this to work. Here are the components and action script:
-Button called "testbutton"
-MC called "target"
-All on one layer in one frame.
Actionscript:
on(rollOver) {
target._alpha = 100;
}
How much simpler can this get? How is this function supposed to work? Thanks in advance!
[F8] Help With List Component Setting Alpha Property On Map
I have been working on an interactive map for a hospital and am almost done. I have a list component that is filled with locations. Upon selecting an item on the list it needs to highlight a building on the map by chaning the alpha setting on a highlight movie clip. The problem comes when you pick a different location. You must click it twice to set the value. I need the list to change the alpha setting on the first click. Here is the related code.
code: function defineproperty() {
}
myListBoxListener = new Object();
myListBoxListener.change = function(eventObj) {
var eventSource = eventObj.target;
var theSelectedItem = eventSource.selectedItem;
var theSelectedItemLabel = theSelectedItem.label;
var theSelectedItemData = theSelectedItem.data;
var buildingpropertyA:String = "_root.mapgraphic.mcgmove.mcgmap.buildings.";
var buildingproperty:String = buildingpropertyA.concat("", theSelectedItemData);
if (count == 1) {
setProperty(buildingproperty, _alpha, var2);
count = count - 1;
} else {
setProperty(buildingproperty, _alpha, var1);
count = 1;
}
setProperty("_root.mapgraphic", _xscale, 80);
setProperty("_root.mapgraphic", _yscale, 80);
setProperty("_root.mapgraphic.mcgmove", _x, -379.7);
setProperty("_root.mapgraphic.mcgmove", _y, -160.6);
};
myListBox.addEventListener("change", myListBoxListener);
This seems a bit complex - here is the link to the map in it's current state:
http://s129542311.onlinehome.us/mcg/
Jeremy
Setting Alpha Property Halts Animation
I have a strange problem. I have an mc tweening from left to right. 2 keyframes, very simple, but when I try to set the alpha of it it halts. Is this a bug in Flash?
i attached the fla
Changing The Alpha Of A Property When Clicking A Button
I have this code in AS 3.0:
stop();
myBtn.buttonMode = true;
myText_mc.alpha = 0;
myBtn.addEventListener(MouseEvent.CLICK, ClickFunction);
function ClickFunction(event:MouseEvent):void{
myText_mc.alpha = 1;
}
I want the alpha of the movieclip called myText_mc to start at 0 (not seen) and then appear when clicked...it does not work, what did I do wrong?
Thanks
Alpha Property On Dynamic Text Not Working
Hello,
I have generated several TextFields dynamically through a for loop. I would like all the text fields to have their alpha set to 0 so that each field can eventually fade in.
When I apply the alpha property by setting it to 0, or even .5 the text appears to still be at an alpha of 1. Does anyone know how to make the text appear with a low to 0 alpha?
I have attached the code from the function which runs the for loop to generate the text fields. Please not that the value of the text fields are stored in a global array, and the text format objects are also global and are declared in the main body of the class.
Thank you in advance for any help you are able to provide, the code is attached below
Lee
Attach Code
private function showSlide():void {
if (s>-1) {
for (var n:Number = 0; n<slides[s].length; n++) {
root["t"+n] = new TextField();
root["t"+n].width = 980;
root["t"+n].text = slides[s][n];
root["t"+n].x = stage.x + 20;
root["t"+n].y = tY + n* 20;
root["t"+n].selectable = false;
root["t"+n].multiline = true
root["t"+0].alpha = .0;
addChild(this["t"+n]);
txtStyle.font = "Arial";
txtStyle.color = 0xFFFFFF;
txtStyle.size = 24;
this["t"+n].setTextFormat(txtStyle);
}
}
}
[AS3] Change Alpha Property Of Button [from Post]
I am trying to change the alpha property of a button using actionscript 3.
I dont want to create external AS file. Can you guide me on this?
Code:
circle_mc.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(event:MouseEvent):void {
trace("You clicked the ball");
//circle_mc.startDrag();
//square_btn.visible=false;
//what should i write to change the alpha of square_btn?
}
Alpha Property Does Change Textfield Prop.
I'm switching the alpha property from 1 to 0 and back on an instance of a custom class that extends a sprite. The code works for the most part. The only thing that does not turn alpha 0 some textfields associated with buttons. I cant think of why the entire button can be alpha 0 and the textfield does not get affected. Any thoughts?
ActionScript Code:
function bsRollOver(event:MouseEvent):void { if (menuCont.getChildAt(1).alpha > 0) { menuCont.getChildAt(1).alpha = 0; } else { menuCont.getChildAt(1).alpha = 1; }}
I'm sure I'm missing simple =/
Alpha Property Causing Play() To Stop Working.
I have a problem that is stopping my mc.play() stopping when I try to set the .alpha property of an object.
I have attached the code and have rem // out the alpha lines.
If you can help I can send you the fla to see the problem occuring.
Regards
Wayne
Attach Code
stop();
// btnRental Button
btnRental.buttonMode = true;
btnRental.addEventListener(MouseEvent.MOUSE_OVER, btnRental_Over);
btnRental.addEventListener(MouseEvent.MOUSE_OUT, btnRental_Out);
function btnRental_Over(e:MouseEvent):void {
btnRental.gotoAndPlay(2);
theGallery.gotoAndStop("fRental");
theGallery.pics.alpha = .7;
txtSplash.htmlText = "<font size="30">Rental Collection</font><br><br><font color="#FFFFFF">Choice of two, ideal for investors, from 7,995 euros complete.</font>";
}
function btnRental_Out(e:MouseEvent):void {
btnRental.gotoAndPlay(11);
//theGallery.pics.alpha = 1;
theGallery.play();
txtSplash.htmlText = "";
}
// btnSilver Button
btnSilver.buttonMode = true;
btnSilver.addEventListener(MouseEvent.MOUSE_OVER, btnSilver_Over);
btnSilver.addEventListener(MouseEvent.MOUSE_OUT, btnSilver_Out);
function btnSilver_Over(e:MouseEvent):void {
btnSilver.gotoAndPlay(2);
theGallery.gotoAndStop("fSilver");
//theGallery.pics.alpha = .7;
txtSplash.htmlText = "<font size="30">Silver Collection</font><br><br><font color="#FFFFFF">Contemporary in style, the cherry range in particular is our best seller, ideal for the discerning buyer.</font>";
}
function btnSilver_Out(e:MouseEvent):void {
btnSilver.gotoAndPlay(11);
theGallery.play();
//theGallery.pics.alpha = 1;
txtSplash.htmlText = "";
}
// btnGold Button
btnGold.buttonMode = true;
btnGold.addEventListener(MouseEvent.MOUSE_OVER, btnGold_Over);
btnGold.addEventListener(MouseEvent.MOUSE_OUT, btnGold_Out);
function btnGold_Over(e:MouseEvent):void {
btnGold.gotoAndPlay(2);
theGallery.gotoAndStop("fGold");
txtSplash.htmlText = "<font size="30">Gold Collection</font><br><br><font color="#FFFFFF">Modern contemporary in style, chic in look, for those seeking a touch of elegance.</font>";
}
function btnGold_Out(e:MouseEvent):void {
btnGold.gotoAndPlay(11);
theGallery.play();
//theGallery.pics.alpha = 1;
txtSplash.htmlText = "";
}
// btnPlatinum Button
btnPlatinum.buttonMode = true;
btnPlatinum.addEventListener(MouseEvent.MOUSE_OVER, btnPlatinum_Over);
btnPlatinum.addEventListener(MouseEvent.MOUSE_OUT, btnPlatinum_Out);
function btnPlatinum_Over(e:MouseEvent):void {
btnPlatinum.gotoAndPlay(2);
theGallery.gotoAndStop("fPlatinum");
//theGallery.pics.alpha = .7;
txtSplash.htmlText = "<font size="30">Platinum Collection</font><br><br><font color="#FFFFFF">This collection is individually tailor made to your requirements perfect for the person who knows what they want or are looking for something different.</font>";
}
function btnPlatinum_Out(e:MouseEvent):void {
btnPlatinum.gotoAndPlay(11);
//theGallery.pics.alpha = 1;
theGallery.play();
txtSplash.htmlText = "";
}
Setting Alpha (brightness) Property In Relation To Mouse X,y Coordinates.
I know this is somewhat simple and I've seen the tutorial before but can't seem to find it when I need it
I have a MC (instance name "footer") that I would like to change the alpha (or brightness) as the mouse nears it. For example, while the mouse is 200 pixels away, the MC's alpha is set to 20%. As the mouse nears the MC, I would like the alpha to adjust according to the mouse's position--making the MC fade in more and more... So when the mouse is right over top of it, the MC's alpha is 100%.
If someone could point me in the right direction.....
Thanks
Schimke
|