ActionScript 2.0 :: Horizontal Slider Bar - Forcing Value To Even Number
Sep 9, 2007
I have created a horizontal slider Bar..and the fundamentals of it work properly... as you slide it, it displays a value between 1-100 in a text field... my problem is that if I stop dragging on an even number, i.e. 59, when I move my mouse after that it bumps the number up to the next even number.. i.e 59 goes to 60. I am using 'onMouseMove' to track the position of the slider bar and update the value, so I am wondering if that is causing it... since if I just stop dragging and don't move my mouse afterwards, it will stay on the even #..but as soon as I move it, it rounds it up to an even number.
My code is below, as well as my .fla attached.
Code:
stop();
//init slider Position/value
this.knob_mc._x=_root.currentClip._xscale;
_root.scaleControl_mc.scale_txt.text=this.knob_mc._x;
this.knob_mc.onPress = function(){
[Code] .....
So, I've been struggling with this for hours. I have a button, a slider (yellow triangle) that moves horizontally within a range. Above the slider is a vertical meter that should move up/down based on the horizontal movement of the slider, i.e. if the slider moves to the left, the meter should rise; if the slider moves right, the meter should fall. Both objects start at the center of their axis as shown in the image provided.
Here's what I have so far to display the masked meter correctly and to limit the slider to the range of the horizontal axis. I can't figure out the rest to make the meter move accordingly. Someone out there for whom this is really easy, please help me through this; talk me through your logic of how to make this work.
is it possible to create a horizontal image slider which browses through photos? [URL]However, I want to make the transitions much smoother and eventually add audio which changes to suit each image.
where can find a tutorial or Tree Menu like the astra Tree Menu with a functional horizontal slider? I am dont know how to make the changes. All I need is the simple astra tree menu but I NEED that horizontal slider.
I made a volumeslider, but the problem is that the sound plays at 100% when the slider is down and at 0% when the slider is up.Of course every volumeslider does the opposite. adjust this code so down, the volume becomes 0% and up 100%?
I'm trying to get a slider to display a number in a Dynamic text field as it is dragged. I think this is the only time I can say it would be easier in AS3! Sooo, I made the slider and the code to move it, but I cant get the number to pass into it. My trace command fires but I get some static numbers in the text box. I'm just so confused, is it my var, or the math operator, or just syntax?
code as I screwed it up ....
on (press) { startDrag("", false, 0, 0, 200, 0); var xmin : Number = min(0);
I'm currently learning Flash (CS4, AS3) and am creating a game. I have currently 1 flv file with 4 scenes, I then move from left to right and then to scene 2 and go from left to right. This is the game where items pop up that need to be clicked on and you get points.
Is there any way I can combine these onto 1 scene? Flash only allows you to have a maximum of 2880px wide.The reason for this is the transition between the scenes is RUBBISH and that my AS is not working correctly in between scenes (it loses values).
What I have is a map that you can click on points and it will zoom in, you can also click on a "plus/minus" buttons to zoom in and out (I even have the mouse wheel zooming in and out). The client wanted me to add a "zoom slider bar" to it so you know you could move it up and down to scale it. Everything is working except the slider, I can't seem to get it to work with the position of the slider. All of the zoom functionality is there but the slider is killing me.
I am putting up the fla file since there is a lot of code in there and I didn't want to put it all in the forum. if you look in the fla in frame ten on line 726 you can find the function that is supposed to handle the zooming when you move the slider. Up on line 74 you can find the slider onPress and onRelease functions, but those I believe should be fine.
I am trying to create a basic timeline, similar to the timeline we all use in flash (see attached).
I have a playhead slider, which when dragged, just drags within its startDrag() limits.
I also have horizontal window scroller which also when dragged, just drags within its startDrag() limits.
I am trying to work out how to get the horizontal window scroller to scroll when the playhead slider hits the left or right edge. I am using hittest for this collision.
I have the playHeadSlider scrolling along the top. When playHeadSlider collides with hittestThing I want mcContents to then move.
It kind of works.. mcContents moves when the playHeadSlider is in collision with the hittestThing.. but it just moves rather than 'drags' across. I have it set up so that mcContents is twice the width (approx) of mcScrollWindow.
I need to somehow update what I have so that if the playHeadSlider collides with hittestThing on the right, mcContents only moves to the right and if playHeadSlider collides with hittestThing2 on the left, mcContents only moves to the left.
Simulating Validators, how do I programmatically invalidate a TextInput because it doesn't match some external criteria? (even though it passes regexp/other internal validator tests).e.g. on lost focus, point out to the user that "confirm email" doesn't match "email" (even though both are valid email addresses). I've got a regex validator on a cell phone TextInput field that ensures the user enters with the international prefix e.g. 0044 for the UK Then I have a confirm_mobile field but I want to check the mobile TextInput against confirm_mobile TextInput.
The input on confirm_mobile could always be a valid phone number and pass the regexp test but I need to ensure field 2 == field 1 and if not then invalidate field 2 (or at least simulate the Validator behavior) to tell the user the fields don't match. I can catch this at the end via a trigger on the form submit button but still need to know how to throw a red box round "confirm_mobile" using a validator.
Code: Select allprivate function check_mobile2(evt :FocusEvent) { if (strings_match(confirm_mobile.text , mobile.text)) {
I just finished a website that requires Flash player 10, and I published in for Flash player 10, but earlier flash players still try to run it.Does anyone know where I can find a script that hides my flash movie and asks the user to upgrade, along with a link to upgrade? the link would start the upgrade installation right there so that users dont have to worry about navigating adobe's website.
I am having the (apparently common) problem, where my flash file won't update its XML source when I make changes. I've research this, and learned that I need to add a unique reference to the loader, to "fool" the browser into reloading the XML each time.
However, I'm not sure exactly where to put the unique variable. Here's my XML loading code.
Currently I have a for loop which goes through and draws a really long list of objects. Each object is contained in its own sprite and as it draws them I wanted to have a text box saying "Ojects" + nObjectsTotalLoaded + " of " + nObjectsTotal + " have been Loaded." Right now I am timing out because my loops takes so long, but i figured that if I have a textbox updating as it creates each object that it will also fix my problem with timeout.
In flex when I allow user to download a file using :
dwFile = new FileReference(); dwFile.download(downloadURL, dwFileName);
Is there a way to ensure that the downloaded file always ends up with the extension .tar or any other extension for that matter? By default I give it a name like xyz.tar, but as of now the user can tamper with filename, including its extension. Can I prevent him from doing so?
I'm writing some actionscript to provide a flash frontend to an MS Excel spreadsheet. The idea is that the user will be able to press buttons in a flash application, and that will enter data into the spreadsheet (which will be read and written as XML).
Through researching, i've discovered that the problem with using getDefinitionByName is that the compiler believes that my classes aren't being used, unless they're explicitly referenced in the code, and thus isn't compiling them into the swf.I'm having no luck finding an amicable solution to this problem though. So far the only thing that i've found which works, is explicitly mentioning the name of the class, somewhere in my code. This creates huge problems as it forces me to manually edit an additional part of the code. And really, harcoding anything is horribly sloppy.this isn't an acceptable solution as i'm designing a game with potentially hundreds of weapons, and two classes for each one. I need some way to automate this, and force them to compile.
I'm dealing with an inline hyperlink in a textarea filled with htmlText. I'm getting incredibly vexxed by this problem with having to click the link twice.I have learned here that this is because the first time a link is clicked, the text area receives focus. Then links become activated. The workaround for this, according to the article, is:
solve this by setting mouseOver = textFieldID.setFocus();
I really wish he'd set this in context, because no variant I've tried works.
Code: mouseOver=showText.setFocus(); and
Code: showSlice.mouseOver=showText.setFocus();
cause the link not to work at all. showSlice is the movie clip containing the textfield, which is called showText.This isn't as bad, but you still have to click the link twice (because I don't think this is doing anything at all):
say I've got an input field and I want the entries to be UPPERCASE, how can I set this up in flash so that these characters appear capitalized even if the user doesn't have CAPSLOCK on? I've tried myTextField.toUpperCase(); but this doesn't work.
I'm trying to create a class that contains an array. However i want to require that the items in the array are themselves of a specific class. Im told there is some sort of tag you can add to do this, but for the life of me i cannot find what it is.What i hope for is something like:
public class myClass{ public var foo:String; [ArrayType(class="BarClass")]
I have an .swf navigation carousel that is 650 pixels high, the bottom 200 pixels being reserved for the reflection of the carousel. The reflection is very subtle and is not considered important information, so we would like to remove vertical scrollbars when the window is high enough to fit the topmost 450 pixels, but not the reflection.
I tried to accomplish this by setting a margin-bottom: -200px to the flash <object> but this only made the container's height shrink 200 pixels, causing the background pattern to cut before the bottom of the page.the Flash itself is still taking up 650 pixels.
Is there some "proper" fix to this, other than hiding/showing the scrollbars actively using javascript?
I need to be able to start/stop or reload this swf with purely javascript as I don't have access to the source swf file to add any actionscript.I figured the easiest way to pull this off is by removing the element and replacing it forcing a redraw with would hince reload the swf movie. Though ie seams to cache the flash element and pretty much look over any updates I make to the embed/object tags and keeps right on going.So how do I force IE to redraw/update a flash element on a page?
I'm making a preloader right now and i want to list kb load, kb total, percent complete and all that jazz in 1 multiline text box like this: Total KB: 100KB Loaded: 56Percent Complete:56when write all this data into the var for the text box how to I force it to go to the next line?
I've got an input field and I want the entries to be UPPERCASE, how can I set this up in flash so that these characters appear capitalized even if the user doesn't have CAPSLOCK on?I've tried myTextField.toUpperCase(); but this doesn't work.
I am trying to set a couple of _global variables with if-then statement, and just after this, use these _globals in the code. However, the code moves on before the _globals are properly set. How can I make the code wait (no timers, please) until the _globals are set?
For my AS3 website, I want to have different buttons at different points in the timeline which load and play external swf videos. These swfs would ideally be displayed on the stage at the actual height and width of the video rather than in a new window.
The swf files themselves will be generated using a third party video player, which wraps itself around an external FLV creating a nice self-contained swf video player (the generated swf contains the player and the video).
The problem is that the third-party video player i'm using ALWAYS displays the loaded swf at the full size of the stage and not the actual size of the swf video. So when the user hits the button to load and play the video, the swf video fills the stage leaving the user no way back to the website.
Also if I use _blank to open it in a new window, it fill the entire browser window.Is it possible to force the width and height at which an external swf is displayed on the stage and if so could some guru give me a code sample to use? It doesn't need to be dynamic according to the swf dimensions, as these will be the same for all videos.
Below is the code I'm using at this point to call the swf:-
var Xpos:Number = 0; var Ypos:Number = 0; var swf:MovieClip; var loader:Loader = new Loader(); var defaultSWF:URLRequest = new URLRequest("swfs/eyesClosed.swf");
[code]....
..it compiles but I don't see the swf at all, whereas if I don't set the width and height it appears. I've changed the width and the height within these variables but the swf never displays unless I remove swfwidth and swfheight from my code.
Dear Guys I Want To Generate A Random Number Between 2 Number BUT Without Generating 2 Same Number I Mean If For Example Already Generated Number "2" Next Time Did Not Generate It , Is There Any Solution