Creating A Light Switch
Hi Guys,
I'm trying to create a light switch on a computer screen but i think I'm not hitting the actionscript just right. Here's what I have.
On the movieclip of the light I have
Code:
onClipEvent(load){
light=false;
}
I then have this on the switch
Code:
on (release) {
if (light=false) {
screen.attachMovie("screenOn", "screen", 2);
light=true;
} else if (light=true) {
screen.attachMovie("screenOff", "screen", 2);
light=false;
}
}
Can anyone tell me where I'm going wrong. Any help is appreciated. Thanks.
SitePoint > Design Your Site > Flash and Actionscript
Posted on: Oct 24, 2006, 18:03
View Complete Forum Thread with Replies
Sponsored Links:
Light Switch
Hi guys,
I'm new here and very happy to be!
I'm a beginner in Flash, nevertheless my company gave me this widget to create.
It is basically done and I'm kind of happy with it but
- please go to
http://www.giuseppecraparottacv.co.u...-lighting.html
to understand what follows -
Click once on the button - click a second time - everything works fine until now.
Now click a third time. The lighting doesn't go back to its original status, as wanted.
Fortunately if you click a forth time, you get what you wanted to get with the third click.
I give you an insight on the ActionScript. I coded:
1)
on(release) {
gotoAndPlay("10");
}
for the button (not the frame) frame 1. 10 is the frame when the turn-light-down animation starts.
2)
on(release) {
gotoAndPlay("30");
}
for the button (not the frame) in frame 30. 30 is the frame when the turn-light-up animation starts.
3)
on(release) {
gotoAndPlay("10");
}
for the button (not the frame) in frame 50. 50 is the frame when the turn-light-up animation ends.
This third piece is intended to let the button trace the point - back in time - in which the light goes down. I wanted to create a button-activated loop with no interruptions.
So why does it take a forth click to have the light down again?
Thank you for your help,
Ray
View Replies !
View Related
[F8] F8 | See My Light Switch Code > It Don't Work | Any Suggestions?
Hi,
I'm just learning about flash and Action scripting and tried to create a simple button that turns an MC(tintbox1) on and off, via the alpha, like a light switch perhaps. So this was the code that i thought might work, but as you can imagine ...
on (release) {
if (_root.tintbox1._alpha=100) {
_root.tintbox1._alpha = 0;
} else {
(_root.tintbox1._alpha=100);
}
}
on (rollOut) {
gotoAndStop(1);
}
Any pointers where i'm going wrong?
Cheers - Dave
View Replies !
View Related
[CS3] "Light Switch" Effect
Yoho.
I was wondering if it was possible to build a "light switch" type of effect in AS2.
I have one variable that is set to either "on" or "off. What I want to do is have the system read that variable and then set a "light" object to either it's corresponding on/off state. The different states are contained within the movieclip itself, so "On" is frame one while "Off" is frame two. What is the best way to do this?
View Replies !
View Related
[F8] Creating A Quiz For 3 Question To Light Up 3 Lights
Basically ive been asked to create a small quiz which will contain 3 questions, these will be displayed as multiple choice.
The aim is obviously to get all 3 question correct but when u answer a correct answer a light from the traffic lights will light up, so basically u have to light up the red light, amber light, then green light
once all 3 lights have been lit then the user gets a new screen where u have a form which the user fills out and their details get submitted to a database... which is already be sorted out.
its just really the quiz thing and gettin the lights lit up that i dont have a clue where to start with.
View Replies !
View Related
Creating English/French Switch
Hi all
I was thinking about adding another language to the site i'm working on, and i was wondering what would be the best way to create a "Language Switch" (for ex. English to French and vice-versa)?
I tought that create two XML file (one english, one french), with the same node's structure would be a good idea, and the make a side menu with something like that:
on (release) {
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("english.xml");
}
and in the 1st movie frame there would be the link to textfields and respective nodes.
would that work (it seems too simple to be true...)? what else should I think of? what would you do if you would have to create one such thing?
- zod
View Replies !
View Related
Creating English/French Switch
Hi all
I was thinking about adding another language to the site i'm working on, and i was wondering what would be the best way to create a "Language Switch" (for ex. English to French and vice-versa)?
I tought that create two XML file (one english, one french), with the same node's structure would be a good idea, and the make a side menu with something like that:
on (release) {
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("english.xml");
}
and in the 1st movie frame there would be the link to textfields and respective nodes.
would that work (it seems too simple to be true...)? what else should I think of? what would you do if you would have to create one such thing?
- zod
View Replies !
View Related
Red Light / Green Light - Those Crazy Shape Hints
Having a hard time with the shape hints. It's not that I can't get results... I can eventually. The odd thing is I can place a bunch of shape hints but they all stay red until something magical happens. Sometimes it seems to be clicking on a different application and then coming back. Sometimes it seems to be clicking on a different layer within MX. In flash 5 I remember having this problem only when the hint was not properly seated on the object and I know that isn't it. Is there some sort of bug?
- B
the humble newbie
View Replies !
View Related
Simple Q: Can You Nest A Switch Inside A Switch?
Hi all,
I have a switch/case/break testing if the Key.RIGHT or Key.LEFT is pressed, then nested inside each of these cases a switch/case/break testing for the _currentframe of the main timeline.
The first few key presses trigger 1 trace comment each (as designed) but after multiple key presses I start to see more than one comment.
So my question is whether switches can be nested as below or whether something else is at fault here.
Paste the code below into the first frame of a 4-frame movie.
code: stop();
//
var myListener:Object = new Object();
myListener.onKeyDown = function() {
currentFrame = _root._currentframe;
trace("currentFrame is " add currentFrame);
switch (Key.getCode()) {
case Key.RIGHT :
trace("You pressed RIGHT key.");
switch (currentFrame) {
case 1 :
nextFrame();
trace("right 1");
break;
case 2 :
nextFrame();
trace("right 2");
break;
case 3 :
nextFrame();
trace("right 3");
break;
default :
trace("default case on Key.RIGHT");
break;
}
break;
case Key.LEFT :
trace("You pressed LEFT key.");
switch (currentFrame) {
case 4 :
prevFrame();
trace("left 4");
break;
case 3 :
prevFrame();
trace("left 3");
break;
case 2 :
prevFrame();
trace("left 2");
break;
default :
trace("default case on Key.LEFT");
break;
}
break;
default :
trace("default case called");
}
};
Key.addListener(myListener);
View Replies !
View Related
Red Light, Green Light
Hey guys,
I have three car animations that all stop when they come to a triggered orange light (trigger = little kid rides up and presses button to cross the road). I want the cars to start up again when the lights turn green.
They are triggered by a seperate light animation motion tweens, switching between green, red and orange.
Eg Car 1: I have an animation that constantly drives a car along the screen using motion tweening. Near the lights there is a key frame that checks a boolean variable if the kid hads pressed the button or not. If not, skip to next frame (a keyframe) and play until the car reaches the end, which then has a gotoAndPlay(1) action - that all works fine.
If he has pressed the button, however, the motion tween jumps forward to a tween out of reach of the initial car animation which makes it come to a stop. What I want is for after the stopping animation, for it to be constantly checking if the light is green on the last keyframe (crossOkay == false).
The thing is, I don't know how to do this. My code at the moment is:
Code:
stop();
if (crossOkay == false){
gotoAndPlay(6); // this is the frame where the car keeps moving after the red light check
} else {
stop();
}
I had a while loop going aswell, but that didn't work either:
Code:
while (crossOkay != false){
stop();
}
gotoAndPlay(6);
Man this seems so simple, I just cant get a hold of it.
Thanks in advance,
Matt.
View Replies !
View Related
Ray Of Light
Hello All,
I'm trying to do the tutorial of the name in the title, Ray Of Light. I was just wondering, why the tutorial doesn't cover the full length of what is required, or, have I picked too complex a one to start off with..? I'm a litle lost, it says to make 2 layers for all the letters then goes into details about making the light effect, which is good, no, great, but then it ends with nothing about what to do with the other layers, the 2nd of the 2 layers for each letter. Sorry if I've missed the jist of it..still at the base of this mountain.
P.S. Yusato, nice site...
View Replies !
View Related
Ray Of Light
im atempting to do the ray of light. im following the tutorial by mark fennel ( http://www.flashkit.com/tutorials/Sp...-1/index.shtml ) And i was Wondering if this was the easiest way, or if there was a simpler way?
thanks in advance
View Replies !
View Related
Ray Of Light?
Hi
I was trying to do that ray of light thing and i got stuck here.
Create 2 layers for each letter. In the case of this demo, lets look at the first letter 'F', create a layer 'F-Light' and 'F'. Copy the letters from the broken text above into their respective layers, so initially we will have a copy of the 'F' in the 'F-Light' and the 'F' layer.
In the 'F' layer, select the 'F' shape, and make it into a symbol (F8) we will use it later, and it needs to be a symbol in order for us to change its alpha values and shapes later on.
To Create the actual lights, go the the layer 'F-light' that has the broken apart version of the letter on it. Using the line tool (set to a different colour to the text) draw the light shape. The first letters (left-most) will have the longest lights and as you get closer to the center of where you want your light to be, the distance the light rays will decrease. This is a matter of perspective. If you are creating the lights that light to the right, make the rays a little longer (you'll see why when you do it!)
Next we fill the shape. First create a new gradient fill, from white to white, make the last white have an alpha transparency of 0%, so that the light fades from white to trasnparent.
Once created you need to fill the lights. Use the gradient tool, and the lock tool to create the perfect effect.
Next use the arrow, and delete all the lines. Then turn the light beam into a symbol using F8, I called mine F-Light
Could ANYONE please help me?.
View Replies !
View Related
Ray Of Light
Well... this has been mentioned before.. but I'm tired of the fact that this tutorial is available, in all its glory, only for flash 5 or something. I don't like the actionscript invoked effect... I like the masked effect... but how to achieve with flash 8? Tutorial?
View Replies !
View Related
Ray Of Light
Hello out there, Im looking for a Ray of Light tutorial for Flash MX but cant seem to find one anywhere :- So, if anyone out there has some spare time on their hands, can you please send a detailed email on how to create the "Ray of Light" effect to my email: cs_oblique@hotmail.com I would highly appreciate this. Thank you.
View Replies !
View Related
Ray Of Light
hi peeps!
im new to the forum, so go easy on me. LOL
anyways, im about 2 weeks old to flash, started using flash5, but got flash MX a couple of days ago.
I was wondering, does anyone mind telling me how to do the ray of light thing in Flash MX?
there is a tutorial on it in flash5, but i cant seems to get it to do the same thing in flash MX.
Thanks
Sandeep
View Replies !
View Related
Ray Of Light
I see this is an old posting so maybe someone has figured this one out. I see some others got stumped on this one as well.
http://www.sitepoint.com/article/flash-script-ray-light
I would like to use this effect, however, I can not figure out how to stop it from showing up on every scene. The “lighting” shows up on every scene when only the layers and script are on one scene. One the scene with the actual layers and script you can see the text and lighting.
If anyone has figured out a way to stop the lighting from showing up on other scenes please let me know.(not just stopping the tween by inserting a stop action behind the tween)
Thanks
MP
View Replies !
View Related
Light FX
Hell, i'm new member i here
I want ask, any body know how i make move light fx; like when your mouse goto up in ultrashock logo you will see move light from left to right.
Thanks
View Replies !
View Related
Ray Of Light . Net
Does anyone know what happended to rayoflight.net (where the -ray of light- effect started)? The site just suddenly went ofline
about a year ago. It was like many others a good point to get so inspiration... Cheers
View Replies !
View Related
Ray Of Light
hi everyone,
can anyone please help me with "ray of light" tutorial. i have tried many times with that but its not working. can anyone please help me with that or if someone knows about any good site which has tutorial on ray of light.
i have already visited flashkit.com, virtual-fx.net and kirupa.com. if you know any other good site regarding this, then please help me.
thanx very much.
devta.
View Replies !
View Related
Can Someone Shed Some Light For Me, Please?
Please excuse my ignorance, and I apologize is this question has been asked before...but I just simply cannot figure out some things in Flash MX. I have downloaded the 30 day trial version and I have every intent of buying it after the 30 days, however, I would like to figure out some things, first. My first problem (despite reading about 20 tutorials) is that I cannot seem to get my flash animation to work probably in the browser. I am trying to do some simple fading text things and it will fade in the flash program, but it will only appear and disappear in the browser...hmmmm?? Also, I cannot seem to figure out how to get an animation to stop at the end of the 90 frames I am working on. It is just starting over again. I have tried to check the loop button, so that it does not loop. I have tried hitting the action...stop button after every layer...but I am at a loss. Nothing is working. So please, once again, pardon my ignorance and thanks for the help!
Mel
View Replies !
View Related
Ray Of Light Tutorial
erm.........i know its kinda dumb.....but bear with me...(and answer me please).....
i'm attempting the 'ray of light' tutorial but i've run into a problem.....i cant do the gradient lighting effect fill in my flash file........i used the fill button but nothing happens.....help please?
View Replies !
View Related
Flash Of Light
Hello,
As my new flash page is comming along great, I want to create a flash of light effect, commonly used on flash sites. I have MX and photoshop any1 know of a link or an answer.
Thanks
Pcride
View Replies !
View Related
I've Read The Ray Of Light Help Already But...still...
Greetings!
I am stuck at one point in the Tutorial: Ray Of Light
I have set and modified a rectangle to each letter and am ready to add a gradient fill. How?
I found a Linear Gradient fill in the Movie box which gives a strip with 5 pointers to adjust gradient fill to which I can apply to my 1st selected rectangle but nothing that allows an entry of 0% to 100% white to white gradient fill. My fills obscure the lettering and furthermore erasing the lines also erases the fill.
Please Help.
Too bad some tutorial aren't planned out a little better so that forums don't get clogged with help request. Ah well....
View Replies !
View Related
Ray Of Light Problem
I tried to follow the ray of light tutorial but I can't even get past the 3rd page. Can someone attach an .fla file of this if they have it handy? The part I get stuck at his creating the light shape out of the letters. It won't let me fill the shape once I drew connecting lines around the letter. Well if you can help my plz respond.
View Replies !
View Related
?-=light Object=-?
I'm creating a game similar to the old zelda play engine (overhead view) and I want my character to be carrying a torch through dark hallways. How can I create a light source that will interact with the environment? What kind of environment can I create to have a light source do something like that?
are there any ways of faking it?
I tried with multicolored bitmaps and multiple circular stacked masks, but it wasn't the effect I am looking for.
Any suggestions would be great-
macromike
View Replies !
View Related
Some Light AS For SNOW
Hey All,
I think the last years winter posts must have got prunned, but I'm looking for some nice light code that I'm able to add more and more snow too if I choose.
I had something last year (or the year before) but I can't seem to find it anymore.
It's going to be used in a 60x450 title, so it needs to be somewhat suttle.
Thanks in advance for the help on this one.
Cheers,
Scott
View Replies !
View Related
Anyone Shed Some Light On This?
Whenever i click on the link to the flash movie from my html splash page i'm greeted by a download file offering. This happens only with files that i uploaded recently so it looks like IE isn't to blame here.
It might be coincidental (doh) but in the html publish settings options all of a sudden i no longer have the plain "flash 5" template available. This has been replaced by "flash only" option. If i use the "detect flash 5" then i get a warning about additional formats and settings.
Any help with this would certainly be very appreciated. Its a nasty problem that id sure like to see the back of.
At present I'm using flash mx, win XP, gin...help
View Replies !
View Related
Ray Of Light Tutorial
Hey,
Does anyone happen to have the .fla file for this tutorial? it would really help me a lot. It is located here: http://www.flashkit.com/tutorials/Sp...en-1/index.php
Please respond.
View Replies !
View Related
Light Effect?
Hi,
http://www.diasin.com/flashindex.html
I am looking to make a similar transition betwen my movies.
The effect I'm looking to acieve is the picture transitions.
They sort of have a radial blur and a kind of glow effect.
I have tried to make it in photoshop, but it does not look very good.
Anyone knows how is it donne?
Maybe they used After Effects and Star Glow or Shine on the graphic.
I was able to make it in After Effects but the file is huge.
Thanks,
Nicolae
View Replies !
View Related
Light Effect
Someone posted once somekind of light effect.
It looks like a paper, in which some letters are cut and a light source is moved behind 'em. I need help. If i click download nothing helpfull cames out and i'm to beginner for tutorial [I made some kind of expression ] Can anyone see that tutorial and help me
It's in tutorials, top rated, light effects or something similar.
View Replies !
View Related
Help With Light Gleam
oi, i need help... im trying to create a gleam of light. if you wanna see what i want it to look like...
go here
go to the 'vitals' section and look at the sun in the background pic. theres a shine coming from the sun... and thats what im trying to make... something like that.
thanx a lot in advance.
View Replies !
View Related
Light Gleam
I'm trying to put like a kind of gleam of light reflecting off an object. kind of like when you take a peice of metal or some kind of reflective surface and put it infront of a light or the sun and turn it.
Please help!! ty
View Replies !
View Related
|