ActionScript 1/2 :: Limiting The Randomness?
Feb 25, 2011
I have this line of code, it's a part of a code that generates mcs at random X and Y, it worked when I wanted it to spawn everwhere, but now i want to limit the X to 200 - 430 this is the code for spawning on all 640 (1-640) pixels of the movie:
this._x = random(640);
i've tried (200-430) but it acts as 200 minus 430 and I end up with the X being 0 somehow
Edit: Never mind, I got it... Here's how: this._x = 200 + random(230);
View 1 Replies
Similar Posts:
Feb 23, 2011
I started converting this flex application to run on android using the new flex hero sdk.i already replaced all mobile-incompatible components and got it running a few times succesfully.
When I use the same libraries running the original webapplication it works perfectly.The big problem however are these random Invalid BitMapdata errors while starting the mobile application. Here's the whole output.
[Code]...
Now it seems to me that, wile running the mobile application, it is unable to find the image, as when I run the webapplication, using the same library where the above line of code is, it is able to find the image.
This problem has been haunting me for days now and I'm really starting to think this is a bug, especially because it sometimes DOES run. Or is there something I'm missing here.
View 1 Replies
Nov 13, 2007
So I've got 10 MovieClips on stage that animate in, and each MC has a stop command on the first frame. I then have this AS on the main timeline on the last frame when everything is in place:
Code:
this._lockroot;
// Random MovieClip Actions
[code].....
View 2 Replies
Mar 23, 2010
I've created a movieclip for the homepage of a website. It is a series of images that are displayed in sequence.
However, I needed the movieclip to start at a random place when the page loads, so I used:
gotoAndPlay (random (1465));
on the 1st frame, which works fine. The problem is that once the movie reaches frame 1465 (the end) it jumps to a random frame again, instead of looping back to frame 1 as I would like.
How do I cancel the random frame function after its 1st use?
View 1 Replies
Dec 16, 2009
How do i use the on(dragover), becuase i am making a simple randomness game,(to start off) because i have something that you can drag, and i want to make it if you drag the thing over it it takes you to a new keyframe.Here is the movie clip i want to be drug on: (nothing happens)
Code:
on(dragOver) {
gotoAndStop(3)
}
Heres the code that you can drag the item(works)
Code:
on(press) {
startDrag(this)[code].....
View 1 Replies
Jul 24, 2009
Is there any way? I thought "maxChars" was promising until I learned it was only for inputting text to a textfield.The XML is coming into a dynamic text box. I need to cut it off at say 500 characters and add an ellipsis.
View 2 Replies
Jul 26, 2010
Quite new still to AS3 so if someone can help me out, or point in the right direction,Stage size is set to 750 wide x 440 high and my hi res image is 1500 wide x 880 high. image is called mcImage.The hi res image on the stage that is scaled down to 50% on both X and Y axes.I have a zoom in button, a zoom out button and a reset button. All do pretty much what their name suggests.When you zoom in, it adjusts the Z axes of mcImage to make the image appear larger on the stage. So far so good.I then get the new co-ordinates of X and Y by using the localToGlobal feature and record them in a variable, passing them to the mouse Handler for the dragging of the image.The issue is, whatever I try in startDrag(); does not limit the size of the dragable image, nothing happens, though I am expecting it to allow me to drag the image around within it's boundary!I am sure that the code can be tidied up, but I am still learning a lot about AS3 and trying my hardest.
[Code]...
View 6 Replies
Jan 1, 2010
Im trying to create a scrolling image gallery that changes when one hits the button by tweening the images left and right and now I'm trying to find a simple way to limit their movements in AS3.
Currently the images scroll infinitely in either direction. Is there anyway to restrict their movements?
Code:
import fl.transitions.Tween;
import fl.transitions.easing.Regular;
RightArrow_Btn.addEventListener(MouseEvent.CLICK, scrollRight)
[Code]...
View 1 Replies
Jan 4, 2011
example im dragin one mc object. with as3 code, and when im draging i want to do next: now
if(400<mc.x<450) {trace("WIN DUDE XD")}[
how to make that interval ?!
every time when my mc is between 400 and 450 on x axis, to trace Win
View 2 Replies
Jun 14, 2006
My knowledge of actionscript is basic, at best. I'm trying to make some animations move randomly by following a very helpful tutorial posted on this site [URL].. And everything was going so well until I tried to use my own initiative to limit the width and height of the movement. This is when I realised that I haven't got a clue what I am doing!
View 10 Replies
Apr 6, 2010
I have a MC made up of 5 vertical images. I have buttons that control the y value of the MC to move it up and down so that you can scroll through the content. Everything works fine, except that I cannot figure out how to make the MC stop moving when it gets to the last image on either end. I assumed it would be something simple like adding a > or < condition in the button so it would stop working at the extremes, but I can't seem to get it to work.
my website to see what it is I am talking about. [URL].. Click on the "print work" link and you should see the MC and the buttons that control it.
View 3 Replies
Oct 24, 2002
I need to limit form data entry to once a day. I have created a login and a PHP script that writes variables to a txt file. However, I want to limit the users ability to enter data to the server date, so that they can only enter in data once per day. For example, a poll that allows a user base to vote once per day. I need to do it using Actionscript, PHP, CGI, or javascript.
View 2 Replies
Jul 28, 2009
I have an array collection that I would like to limit to say 100 items. I tried setting up a filter function where the return was:return (myAC.getItemIndex(item) > 100);but the value was always -1. For whatever reason it couldn't find the item, even though the item is definitely there.I'm able to do this with a while loop:while(myAC.length > 100) myAC.removeItemAt(100);
View 4 Replies
Oct 13, 2011
I want to know how to prevent the user from drawing outside my school board.
My board image sizes 709.15 X 499.5. So I thought of something like this...
if(stage.stageWidth <= 709)
But if my board image is being called as a variable on stage boardActiva it should be easier.
Here's the function that draws:
private function dibujar(e:MouseEvent){
trace(e.localY);
tizaActiva.x = e.stageX;
[Code].....
View 1 Replies
May 21, 2010
I was trying to produce an output of an array mixed up and limit the number. how that is done. Now need to incorporate into a quiz application which pulls in data via, XML, displays that, and shows the number of questions. So if 50 questions are in the XML file 50 questions will be displayed in the quiz. What I am trying to do is use the XML file as a question pool and randomly select say 30 questions out of the file to display. no luck so far, but I am making progress!
[Code]....
View 1 Replies
Apr 20, 2010
I have an Flash CS4 application which pulls in data (questions) via XML and randomizes them. Right now if there is 50 questions in the XML file, 50 questions are displayed and randomized in the application. I am trying to figure out how to limit the randomizing pool so that only 35 questions display(even when the XML file has 50 questions) or something like that. My current code which brings in the file and randomizes is below. The code is written in AS3, by someone else.[code]
View 1 Replies
Jan 2, 2007
I have a question that I would really love answered. I have put script on a button which will scale a movieclip in intervals when pressed by the viewer. My question is if there is a way to tell it to stop at a certain point? Here is the code on the zoom button.
Code:
on (press) {
bigscan1._xscale += 25;
[code].....
View 5 Replies
Feb 9, 2009
At one point in my script I'd like to check a MC for the number of children and limit this number to 3. For that I use this script:
Code:
if (container.numChildren > 3){
for (i = container.numChildren; i > 3; i--){
container.removeChild(container.getChildAt(i-1));
popError('Horizontal nur 3 Elemente!');
}
}
This somehow works fine if there are 4 or 5 children in the MovieClip, but as soon as there are 6 or more, it throws an Argument Error #2025 and does not remove anything. BTW it does not make difference if I use container.removeChildAt(i-1);
View 2 Replies
May 17, 2010
I have an Flash CS4 application which pulls in data (questions) via XML and randomizes them. Right now if there is 50 questions in the XML file, 50 questions are displayed and randomized in the application. I am trying to figure out how to limit the randomizing pool so that only 35 questions display(even when the XML file has 50 questions) or something like that. My current code which brings in the file and randomizes is below. The code is written in AS3, by someone else. this part of the code pulls in the XML data and randomizes.
Code: Select allpackage exam {
import flash.net.* //to create URLRequest and load XML file
import flash.events.* //for Load events
[code]....
View 7 Replies
Apr 20, 2011
I already know how to limit my input text to a number of characters, but how would I go about (if possible) making sure characters do not repeat? In other words, I have a ten character input text box and I want you to be able to type pretty much any character but only one of each.
Example:
AFKEIOPCNK
What I'm trying to eliminate is this:
AANHDKDDJI
If that isn't possible, I'd like to instead detect if there are repeated characters so I can just say "that's invalid".
View 2 Replies
Dec 12, 2008
I have confirmed this behavior in FMS 3.0.2 on Windows 2003, Vista, and Linux.
In prior versions of FMS if I had a publisher sending a live video feed to the server, then I could have subscribers connect to the server and set a bandwidth limit for them and the server would ensure that the subscribers only got as much bandwidth as I set for them. As of version 3, the server now ignores this limiting for live streams.
You can set a limit on the publisher which of course then limits the live stream that subscribers view, but that is not what I want. I want to have the publisher push a live stream at the quality I specify and then I need a way to give some subscribers a lower bandwidth version of that stream. This all worked fine in prior versions of FMS and I can't imagine this is intended behavior in version 3, but it seems like a major oversight.
The bug can be replicated by creating a simple flash app to stream live video to the server and then in a separate NetConnection, subscribe to that live stream and display it. Then on the server side, setup an application.onConnect to do a setBandwidthLimit on the subscriber and you can see that it is totally ignored. You get the full bandwidth stream even though the limit should be reduced for the subscriber.
View 22 Replies
Apr 21, 2009
Since I only need numbers, can I limit dynamically embedded fonts to only numerals, periods, dashes and special characters copied from the character map?
View 5 Replies
Jul 2, 2009
I need the ability to create a TextArea entity in a constrained area (i.e., it is located at x and y and is w pixels wide and h pixels high and have that never change.), containing a proportional width font. As such, no 'num char entry limit' strategy is feasible. They need to be able to fill the entire area, and if that means 1,000 period '.' characters, or 200 '#' or "W' characters, then so be it.
The two lines following this one consist of 30 periods followed by 30 Ws.
..............................
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
I cannot limit a user to 30 characters. They need to be limited by using a TextArea that will let itself be filled until full, and then refuse further input until space is created by removing existing content. I then need to print that TextArea _as rendered on the user's screen_. Any 'scrolled' lines would be unprintable, and therefore the user's entry must be limited BEFORE any scrolling occurs, or contrariwise, when scrolling occurs, the last entered content would need to be removed and the entity forced to un-scroll. I can program this. It won't be elegant, and in fact will be quite stupid, as any programming where a change event is called with each keystroke or paste and then conditions tested is inefficient, wasteful, and well.
View 3 Replies
Oct 6, 2009
I have a flex application which collects data entered by the user and posts it off to a web service I have running on a back end server. The flex application does not authenticate users (it's available for anyone to use without setting up an account) and communicates to the web service using HTTPS. There is an XML firewall in place for preventing certain malformed requests, DoS attacks etc and the web service validates all data received from the client.
If I was to sign the content then I could use the XML firewall to verify the signature but I assume that any certificate type data I embed in the client could be extracted out of the flex app through some means of de-compilation. My question is, is there any way of limiting calls to the web service to only those from my flex client? I understand that a user could input bad information but I'm really trying to prevent another client or 'bot'.
View 2 Replies
Aug 10, 2009
The code below is currently what I am using to use the middle mouse wheel to control the position of the page... sort of a DIY page scrolling mechanism, luckily I only need up and down ( ._y property)...
ActionScript Code:
mouseListener = new Object();
mouseListener.onMouseWheel = function(delta) {
[code].....
View 4 Replies
Sep 14, 2006
I've been working on Kirupa's adding thumbnails to the XML photo gallery. I've managed to change the scroller to one that is vertical and reposition it to where I wanted it and everything works fine. urrently the code accounts for when the mouse moves (on the horizontal) to the left or right of the thumbnail container to stop scrolling. However when the mouse moves up and down to scroll (on the vertical) it continues to scroll even though the mouse has moved outside the container area. I'd like for it to only scroll when the mouse is within the 30 pixel - hit_left/right boudaries.
Here's the code, as you can see the changes have been very little from the original.
[Code]...
View 1 Replies
Nov 25, 2006
I am using the following code to perform a rewind on the timeline when a button is pressed:On the REWIND button:
Code:
on(release){
rewState = true;[code].....
My question is, can I limit the rewind feature to just 12 frames at a time? Right now it rewinds back to the beginning, totally skipping all the stop(); commands on the timeline. I've tried for, do, and while loops in various places (one nearly froze my computer up!) with no luck.
update: I've added the following to the code so the user can at least stop the rewinding:
Code:
on(rollOver){
rewState = true;
}[code]....
but the thing moves forward in 12frame intervals.It is wierd having it move in reverse freely like this. So I am still looking for a way to get it to move the timeline backwards in 12 frame intervals...
View 2 Replies
Sep 23, 2008
I have some rectangles inside a movieclip. All movieclips are created by actionscript. I want to limit the size of the movieclip on top right corner when user starts drag.
Code:
this.holder_mc.onEnterFrame = function() {
this.holder_mc.rectangle_6._xscale = this.holder_mc._xscale-260;
[code].....
View 1 Replies
Oct 8, 2010
I got a movieclip which should be dragable horizontally and vertically, however it should be "locked" horizontally when dragging vertically as well as the other way around.[code]
View 6 Replies
Jun 10, 2010
I've created a ComboBox skin by extending mx.skins.ProgrammaticSkin. It's working fine, except I can't figure out how to limit the width of the text. Is there a way to control this within the skin?
See the attached image for an example of the text going too far. I would like it to stop before the separator line to the left of the down arrow.
View 1 Replies