ActionScript 2.0 :: Throw And Slide Function
Oct 22, 2010Anyone know a easy way to grab and throw / move a movieclip so it slides for a bit then gradually slows down?
View 1 RepliesAnyone know a easy way to grab and throw / move a movieclip so it slides for a bit then gradually slows down?
View 1 RepliesI want my event listener function to throw out unique random numbers between 1 and 30. How does one do that in as3? Math.round will repeat values.?
View 2 RepliesGo to URL.... If you click on one of the category names for photos at the top of the screen, the 'view' will slide into position over the relevant gallery. The only problem is that the first time you slide to any gallery the transition of the pan is very jittery.I am using the Tweener class and here is the script:[code]
View 1 RepliesI`m building a photo slide projector that calls a function using setInterval. But after the tenth call (about after 50 sec) the flash player stops working and crashes.On the first frame of the main timeline I set the following code:
Code:
// comando para fullscreen
fscommand("fullscreen", "true");
fscommand("allowscale", "false");
[Code]...
I am using currentSlide.gotoNextSlide to change between slides, however I can't make it stop playback on load of each slide.I have a motion tween with I need to NOT play automatically when the slide loads... but no matter how many iterations of stop(), gotoAndStop(), etc I use, nothing will stop the clip from playing when it is loaded!
View 1 RepliesHow could I get a nice tween like this one: [URL] Specifically the now playing slide in and slide out effect.
View 1 RepliesI am creating a flash slide presentation to use as part of an online portfolio. I have created a presentation that so far has three slides, each containing a flv that I imported and added a skin to.Is there any way to stop the movie on slide one (besides manually) when I move to slide two? I don't care if the mvie returns to the begining or not i just want to beable and view the video on slide two without hearing the sound from slide one.
View 5 Repliesthis is what I am trying to do:
1st slide: pre test (3 radio buttons)
2nd slide: video
3rd slide: post test (3 radio buttons) - this page has a submit button that calls a .php script
The Pre Questions are setup like this:[code].....
wondering if this is a Global Variable problem? Is there any reason that the "variables" variable would stop populating after the first slide? Obviously, they are getting to the last slide since the submit button is passing them (or is the external file doing it?), but don't know why the post ones are not going.
I am trying to build a vertical slide scroller based on a tutorial for a horizontal slide scroller and am having difficulties undertanding what values I need to change in the code for the slider mc in order to make it work. The horizontal slider is quite smart and there is additonal functionality attached to it to affect it's movement which I'm not too worried about although it would be nice)
Code:
// set up content_mc info
contentRight = _root.content_mc._x;
[code].....
I am trying to throw a ball in an arc, either an arc going left or right.
Here is my code:
var gravity = 2;
this.velocity.y += gravity;
_angle = 5;
[Code].....
It doesn't really look like the ball is "arcing" at all, it seems to be more of a diagonal line?
I need to access the elements of an array that is declared in the main swf(_level0). But I need to change it from another swf.How can I do it??So far I have this:
MAIN SWF:
var vector1:Array = [biblio_vid1, biblio_vid2, biblio_vid3, btn_1_4, biblio_vid4];
OTHER SWF:
var vector2:Array = _level0.vector1.slice();
trace(vector2); // undefined,undefined,undefined,undefined,undefined
I'm creating a map in flash and I would like to have a smooth movement similar to this:[URL]..i have made a start but I'm having trouble taking it to the next stage.
My code currently throws the movieclip after the mouse is release but there is no easing while the mouse button is down.
[Code]...
I'm trying to make a button draggable and also throw it across the screen. I know that I have to use the mouseDown and mouseUp options for the button, but could someone explain a method for allowing me to drag it and then throw it? In other words, it should keep going after mouseUp.
View 1 RepliesI am trying to create a drag and throw effect I have most of the effect working correctly but I am wondering how to only move one item at a time and have that thrown unaffected til the friction brings the item to a stop. what happens currently is if an mc is moving and you select another it moves both items.
Code:
var mx0; // Previous Mouse X Position
var my0; // Previous Mouse Y Position
var velocityX = 0; // Velocity in X Direction[code]...................
I need to access the elements of an array that is declared in the main swf(_level0). But I need to change it from another swf. I have this:
MAIN SWF:
var vector1:Array = [biblio_vid1, biblio_vid2, biblio_vid3, btn_1_4, biblio_vid4];
OTHER SWF:
var vector2:Array = _level0.vector1.slice();
trace(vector2); // undefined,undefined,undefined,undefined,undefined
I'm a total beginner trying to do some basic navigation using AS3.I was following along a lynda.com tutorial and being careful not to have any syntax errors but for some reason it just won't work.The trace function doesn't work and I'm also getting this error message.[code]
View 2 RepliesI'm developing a flex application and I want to access a component by using it's id.
I know I must use .property of the component. The problem is I have the component Id in a String var and now I don't know how to access to it's properties.
I'm learning AS3 and I'm trying to build a little interaction where I can throw a square off the stage. It just need to stay on the x-axis, to be thrown either to the left or right.I found quite a few tutorials where it involves physics. I don't need anything as complicated as that. With mine, as long as you click down on the square and throw it a bit, doesn'tmatter how hard that throwing action is, the square will always be thrown off the stage, depending on the direction of your mouse.I kind of have the idea in my head that the "throw" feel can be done with tween in a movieclip (since it only need to go to either left or right), which will be activated depending on the direction of the mouse.
View 1 RepliesI am trying to load an External swf.
But it throws an error when I compile.[code]...
I invoke the Flex mxmlc compiler from a Java application. After adding the Xerces parser to the project classpath I get the error below.
java.lang.IllegalAccessError: class org.apache.xerces.util.XMLAttributesMMImpl$AttributeMMImpl cannot access its superclass org.apache.xerces.util.XMLAttributesImpl$Attribute
at java.lang.ClassLoader.defineClass1(Native Method)[code]...........
this will throw a runtime error if you don't override the init function in an extending class. (look below)
is there anyway to force a COMPILE error instead of a runtime error? my guess it not, but if there is a way i want to do that
[Code]...
I have a drag & throw style horizontal content scroller with ease movement that works great in other browsers but dosn't seem to want to work in Firefox 9.0.1. on a mac. Has anyone had this problem and if so what can be done to fix it?
View 0 RepliesI've been looking all over for a script that lets you grab an object, it swings as you move it around, and then lets you throw it. I've seen this in games and goofy Flash sites.
View 2 Replies(How) is it possible to catch an error thrown in a callback function like onConnect of the XMLSocket object?
Code:
var s:XMLSocket = new XMLSocket();
// Will not catch error :-(
try {
[Code]....
I have buttons on my main timeline which calls a MC using attachmovie(). I have placed an EmptyMC on my main timleline for the MC to be inserted. Now, this particular MC has buttons on it which work fine. However, when I add a throw component onto the EmptyMC, which basicly lets me drag/throw my attached mc, the buttons are disabled.[code]...
View 5 Repliesi want to have the user be able to drag and throw movie clips around the stage, but with the code i have so far it only allows for one...how can i give the function to multiple clips without repeating the code a million times? here is what i have
Code:
bag.onPress = function(){
anchorX = this._xmouse;
[code].....
I'm stuck trying to achieve something in AS2. The principle is easy: the user can drag/throw a timeline (with thumbnails) around, but I want it to snap to certain positions. I've created an example to show what I need ,You can already drag/throw the timeline around, but, as it slows down, I want it to always snap into a position where one of the purple rectangles snaps to the grey area so a thumbnail is always covering the grey area.
So when you throw the timeline hard enough, it would fly quite far (speed of timeline > attraction force of the snapping points), but as it slows down, the snapping force takes over and the timeline snaps in place.
(How) is it possible to catch an error thrown in a callback function like onConnect of the XMLSocket object?
Code:
var s:XMLSocket = new XMLSocket();
// Will not catch error
try {
s.onConnect = function(success) {
trace(success);
throw new Error("Unable to connect");
trace("Won't trace, error thrown"); }
s.connect("127.0.0.1",1024); }
catch(e:Error) {
trace(e) }
I have buttons on my main timeline which calls a MC using attachmovie(). I have placed an EmptyMC on my main timleline for the MC to be inserted. Now, this particular MC has buttons on it which work fine. However, when I add a throw component onto the EmptyMC, which basicly lets me drag/throw my attached mc, the buttons are disabled. How can I go about correcting this?
Here is the code for the button on the main timeline:
on (release) {
_root.EmptyMC.attachMovie("Content Def", "Clip2", 1);
}
Here is the code from the component I have attached to the EmptyMC:
#initclip 0
function ThrowBehaviorClass(){
// get the target
var target = this._parent[this._targetInstanceName];
// set up the various properties
[code]....
I get a Flex 3 sandbox error #2048 after connecting to a Socket on a Java (1.5) server. The server code is all mine, i.e. not running under Apache. Flash Player 10.0 r32.The sequence is as follows...
1 Java server starts, listens on port 843 for policy file request and on port 45455 for my other requests.
2 Flex client served by Apache (although I get the same result if I run it from the file system), socket connection made on host:45455.
3 Flash Player requests policy file from port 843. This is the standard behaviour with the new security settings looking for a master file. It happens regardless of whether a different policy file has been specified.
4 I serve the following XML from Java through port 843:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" secure="false"/>
</cross-domain-policy>
5 The player writes the following into the debug policy log...
OK: Root-level SWF loaded: http://localhost/bst/BasicSocketTest.swf
OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at xmlsocket://192.168.2.3:45455 by requestor from http://localhost/bst/BasicSocketTest.swf
OK: Policy file accepted: xmlsocket://192.168.2.3:843
OK: Request for resource at xmlsocket://192.168.2.3:45455 by requestor from http://localhost/bst/BasicSocketTest.swf is permitted due to policy file at xmlsocket://192.168.2.3:843
6 I send a text message from the client to the server on port 45455 using writeUTFBytes() and flush() (this is my own home-baked message protocol, and is correctly processed at each end)
REG/REGISTER;simon;Si
7 Java server thread listening on port 45455 responds with
REG:0/REGISTER:SUCCESS;simon;Si
8 The Flex client receives a ProgressEvent and the event listener I bound to the socket gets called. I process the message (write it to a text box on the screen)
9 The Flash player throws a 2048 sandbox error and the socket is disconnected! This is after the message is received and processed successfully. In fact it is about 12 seconds after. Nothing else works through the socket.
I have tried explicitly loading a policy file with a call to Security.loadPolicyFile() in the Flex client, but the reality of the new player security is that it is basically ignored. The steps are that the policy request will not get sent until a socket i/o operation occurs. At that point the player always goes to port 843 first looking for a master policy file. If it finds one, and it is permissive, it goes no further.
I have tried a variety of alternative ways of terminating the policy file and policy file contents, including deliberate errors just to see if the Flash Player is awake.I can see no reason why I would have a 2048 being thrown. I accurately serve a socket policy file on the designated master security port, which the player itself logs as correct. The socket then successfully sends and receives a message from the server the contents of which are available to my code.
P.S. Please don't tell me to use BlazeDS or LCDS or Granite, or something else as a server, I'm looking for a solution to this problem, not a redesign. And please don't ask me to use an XMLSocket instead - I tried that and get exactly the same result. I have chosen my architecture carefully and deliberately and I want a binary socket.
EDIT :In response to James Ward's request in his comment, here is the entire error message:
Error #2048: Security sandbox violation: http://localhost/bst/BasicSocketTest.swf cannot load data from 192.168.2.3:45455.
I have a stripped down test client which has a handler for each socket event and outputs a message to the screen. This is what it shows:
RequestPolicy: 192.168.2.3:843
Create Socket: 192.168.2.3:45455
Connect: [Event type="connect" bubbles=false cancelable=false eventPhase=2]
Sending: REG/REGISTER;simon.palmer@gmail.com;Si
Receiving: REG:0/REGISTER:SUCCESS;simon.palmer@gmail.com;Si/
Close: [Event type="close" bubbles=false cancelable=false eventPhase=2]
Error #2048: Security sandbox violation: http://localhost/bst/BasicSocketTest.swf cannot load data from 192.168.2.3:45455.
The close event is fired immediately after successfully receiving a response from the server, however the Error #2048 does not appear until about 20 seconds later. If I try and send a further message after close, but before the error, the Flash Player throws an invalid socket exception.