Drag And Throw...
I've nearly got this drag and throw feature working. Can anyone fix the problem that only one object will drag and throw though?
thanks G
FlashKit > Flash Help > Flash ActionScript
Posted on: 04-26-2006, 12:01 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
- Drag And Throw
- Drag And Throw
- [AS1.0]drag And Throw
- Drag And Throw...
- Drag, Throw And Rotation
- Drag And Rotate And Throw
- Drag Drop And Throw
- Drag And Throw XML Gallery
- Drag And Throw? Game Gurus, Please Help
- [Tutorial] Drag And Throw Movieclip
- Grab, Drag And Throw Effect.
- How Do You Make This Drag And Throw Thing?
- Throw/Drag Disables MC Buttons
- How Do You Make This Drag And Throw Thing?
- How'd They Do This - Drag, Drop, Throw, Rotate, Intertia
- Drag/Throw Component Disables Buttons
- Drag & Throw + Physics & Forces Effect
- Drag And Throw W/ MULTIPLE Movie Clips
- Drag/Throw Component Disables Buttons
- Throw A Ball Away From Me
- Throw Them To Different Directions
- *picks Something Up And Throw It* HELP PLEASE
- Throw,catch Set And Get In AS2
- Throw Stick Man (help)
- Can I Throw A Warning?
- [CS3] Throw Me A Bone...
- Throw And Collide AS3
- Throw Ball Example
- Throw And Collide AS3
- How To Throw A Movieclip?
- Downloading Throw Flash
- Throw Me A Bone Here, People...
- Arrays Throw Me In Disarray
- Throw Object With Friction
- How Can Adress Var Throw Levels? How
- Throw Away That Array, Use A MC SongList Instead...
- Pick Up And Throw A Movieclip
- Im Going To Throw My Computer Off A Balcony
- 3d Dice Throw, Physics
- Throw The Knife Dangit
- BAH Ready To Throw Computer Out The Window
- Rotate Dial With Throw Effect
- Using Value Variables Throw Public Functions
- Throw An Array As Function Parameters
- Throw Error On Improperly Formatted XML?
- Throw Boxes On Stage That Don't Hit Each Other, HitTest...
- Using Value Variables Throw Public Functions
- Beach Ball Hold And Throw?
- How To Throw An Error When No Netstream Connection?
Drag And Throw
i am trying to make a movie where u pick something up and throw it. can anyone help me?
Drag And Throw
i am trying to make a movie where u pick something up and throw it. can anyone help me?
[AS1.0]drag And Throw
http://www.rg512.com/campaign/
what's the concept of this code? I've always want to learn how to make a drag and throw and effect, any tutorials on this? like drag and throw out with gravity, and bounce back thing...thank you!
Drag And Throw...
Hey guys.. i'm new to AS...
does anyone know how to actually create an image.. get it to stick to the cursor.. and actually throw it..around??..
much help appreciated.. Thanks..
Drag, Throw And Rotation
Hi everybody,
will someone help me to create movie clip with action drag, throw and rotation, like on website http://www.intentionallies.co.jp/
Thanks for any help.
Drag And Rotate And Throw
hi so i wanted to make a movie clip able to be thrown around which i have found in the code below. but i always wanted the movie clip to be rotated? like when i start spinning the mouse while holding on the movie clip, the movie clip with spin around or twirl.. help much appreciated. thank you
Code:
puck.onRelease = puck.onReleaseOutside = function(){
xDirection = (_root._xmouse - lastXMouse);
yDirection = (_root._yMouse - lastYMouse);
this.onEnterFrame = function(){
// decay x
if (Math.abs(xDirection) > 0.5){
xDirection *= .9;
} else {
xDirection = 0;
}
// decay y
if (Math.abs(yDirection) > 0.5){
yDirection *= .9;
} else {
yDirection = 0;
}
//Garbage Collection
if (xDirection == 0 && yDirection==0){
this.onEnterFrame = null;
}
//Bounce off the walls
if (this._x < 0){
xDirection *= -1;
this._x = 0;
}
if (this._x + this._width > Stage.width){
xDirection *= -1;
this._x = Stage.width - this._width;
}
if (this._y < 0){
yDirection *= -1;
this._y = 0;
}
if (this._y + this._height > Stage.height){
yDirection *= -1;
this._y = Stage.height - this._height;
}
//Position
this._x += xDirection;
this._y += yDirection;
}
}
Drag Drop And Throw
i was just wondering how you can drag and throw things like on http://www.thibaud.be/ where you can drag and throw the little windows?
Drag And Throw XML Gallery
I'm trying to extend the XML Gallery into somewhat of an environment that does the following things.
1) Thumbnails appear 1 by 1 on random positions on the stage, like Intentionallies
This and all the XML stuff I can do.
2) Ability to drag and drop thumbnails over a "dock" and the thumbnail snaps onto the dock. Sort of like a drag and drop shopping cart.
I can do this and the dock also, with a backend and shareobjects.
3) Drag and Throw of thumbnails. Just friction and bouncing off boudaries, no gravity. Like on a tabletop.
4) Combining 2) and 3) so that a thumbnail can be dragged around and thrown into the "dock" area.
So far I have found enough resources to achieve1) and 2) and I'm absolutely a physics idiot so 3) and 4) are strange worlds to me.
I'm not asking for an FLA that does that but I would really appreciate if you guys can point me to some links to resources where i can learn and try to apply the relevant code to my concept. Even better if I can have sample FLAs that does one of these things.
I am really motivated to create such an interface as I feel it would really be a nice way to use a gallery. It's just like a real tabletop with your photos.
If I can manage to build something like that, with the help of the community, I will definitely post the source codes back and share it with all who have helped.
Drag And Throw? Game Gurus, Please Help
Hello,
Here is my situation:
A movie clip represents a hand on stage,wich is moveable in x position with the left and right arrow key.
There are 8 targets (balls) wich one by one should stick on the hand, when it is over it, and the down key is pressed.
Then ones sticked, you should be able to throw that ball on a target...
I imagine something that it has to do with _x and _y properties of both wich should be continuosly checked wether the hand is above a target or not...
It's hard to explain somehow, therefore i created this little dummy movie
here. I hope it makes more clear what i'am trying to achieve...
http://01interactions.net/ego_shooter/problem.htm
Thanks very much for any help
Alex
Grab, Drag And Throw Effect.
I'm looking for an effect to my script that enables me to "grab" a mc. rotate it and throw it into the wall where it rotates while floating and slowing down after the throw.
I am looking for a good gode with comments or someone to help me thru this.
Found the effect i wanted right here: http://www.dynamicfactory.us/xmlswfdemo/cats/
Try grabbing the products and play
Anyone can help me here? Thanks
Throw/Drag Disables MC Buttons
Hi,
Here is my problem, I have an emptymc on my main timleline which calls another mc using attachmovie(). Now, this particular mc has buttons on it which work fine. However, when I add a throw component onto this emptymc, which basicly lets me drag/throw my attached mc, the buttons are disabled. How can I go about correcting this? Any help is greatly appreciated.
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
target.friction = (100-this.friction)/100;
target.accel = this.acceleration/100;
target.useHandCursor = this.showHand;
target.snapToCenter = this.snapToCenter;
target.xspeed = 0;
target.yspeed = 0;
// set the onPress handler for the target
target.onPress = function(){
this.startDrag(this.snapToCenter);
// track the speed of the target
this.onEnterFrame = function(){
this.oldX = this.newX;
this.oldY = this.newY;
this.newX = this._x;
this.newY = this._y;
}
// make the dragging smooth
this.onMouseMove = function(){
updateAfterEvent();
}
}
// handle the releasing of the target
target.onRelease = function(){
this.stopDrag();
// set the new speed of the target
this.xspeed = (this.newX - this.oldX) * this.accel;
this.yspeed = (this.newY - this.oldY) * this.accel;
// let the target ease with friction
this.onEnterFrame = function(){
this._x += this.xspeed;
this._y += this.yspeed;
this.xspeed *= this.friction;
this.yspeed *= this.friction;
if (Math.abs(this.xspeed) < .1 && Math.abs(this.yspeed) < .1){
this.onEnterFrame = undefined;
}
}
// turn off the mouseMove handler
this.onMouseMove = undefined;
}
// set up the releaseOutside handler as well
target.onReleaseOutside = target.onRelease;
// hide and stash the behavior clip
this._visible = false;
this._x = -1600;
this._y = -1600;
}
// register the class
Object.registerClass("throwBehavior", ThrowBehaviorClass);
#endinitclip
Thanks
How'd They Do This - Drag, Drop, Throw, Rotate, Intertia
I can find a bunch of simple drag and drop tutorials, resources, etc. but none involving inertia / gravity (whatever you wanna call it) or rotation or throwing of movieclips like this one - http://www.1-18-08.com/. Does anyone know of a tutorial or resource that might help me get started?
-- Thanks for looking and/or helping. Paul.
Drag/Throw Component Disables Buttons
Hi,
Here is my problem, 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? Any help is greatly appreciated.
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
target.friction = (100-this.friction)/100;
target.accel = this.acceleration/100;
target.useHandCursor = this.showHand;
target.snapToCenter = this.snapToCenter;
target.xspeed = 0;
target.yspeed = 0;
// set the onPress handler for the target
target.onPress = function(){
this.startDrag(this.snapToCenter);
// track the speed of the target
this.onEnterFrame = function(){
this.oldX = this.newX;
this.oldY = this.newY;
this.newX = this._x;
this.newY = this._y;
}
// make the dragging smooth
this.onMouseMove = function(){
updateAfterEvent();
}
}
// handle the releasing of the target
target.onRelease = function(){
this.stopDrag();
// set the new speed of the target
this.xspeed = (this.newX - this.oldX) * this.accel;
this.yspeed = (this.newY - this.oldY) * this.accel;
// let the target ease with friction
this.onEnterFrame = function(){
this._x += this.xspeed;
this._y += this.yspeed;
this.xspeed *= this.friction;
this.yspeed *= this.friction;
if (Math.abs(this.xspeed) < .1 && Math.abs(this.yspeed) < .1){
this.onEnterFrame = undefined;
}
}
// turn off the mouseMove handler
this.onMouseMove = undefined;
}
// set up the releaseOutside handler as well
target.onReleaseOutside = target.onRelease;
// hide and stash the behavior clip
this._visible = false;
this._x = -1600;
this._y = -1600;
}
// register the class
Object.registerClass("throwBehavior", ThrowBehaviorClass);
#endinitclip
Thanks
Drag & Throw + Physics & Forces Effect
I was trying to find a sample that can simulate the following sample (by yugop) as close as possible
http://www.intentionallies.co.jp/content_normal.html
I'm particularly interested in the part where you can throw the object by just spinning it around its center.
Something like centrifugal force.
Pleases let me know if you've seen something similar to that.
Thanks in advance.
Drag And Throw W/ MULTIPLE Movie Clips
I 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
bag.onPress = function(){
anchorX = this._xmouse;
anchorY = this._ymouse;
this.onEnterFrame = function(){
lastXMouse = _root._xmouse;
lastYMouse = _root._ymouse;
this._x = _root._xmouse - anchorX;
this._y = _root._ymouse - anchorY;
}
}
bag.onRelease = bag.onReleaseOutside = function(){
xDirection = (_root._xmouse - lastXMouse);
yDirection = (_root._yMouse - lastYMouse);
this.onEnterFrame = function(){
// decay x
if (Math.abs(xDirection) > 0.5){
xDirection *= .9;
} else {
xDirection = 0;
}
// decay y
if (Math.abs(yDirection) > 0.5){
yDirection *= .9;
} else {
yDirection = 0;
}
if (xDirection == 0 && yDirection==0){
this.onEnterFrame = null;
}
if (this._x < 0){
xDirection *= -1;
this._x = 0;
}
if (this._x + this._width > Stage.width){
xDirection *= -1;
this._x = Stage.width - this._width;
}
if (this._y < 0){
yDirection *= -1;
this._y = 0;
}
if (this._y + this._height > Stage.height){
yDirection *= -1;
this._y = Stage.height - this._height;
}
//Position
this._x += xDirection;
this._y += yDirection;
}
}
Drag/Throw Component Disables Buttons
Hi,
Here is my problem, 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? Any help is greatly appreciated.
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
target.friction = (100-this.friction)/100;
target.accel = this.acceleration/100;
target.useHandCursor = this.showHand;
target.snapToCenter = this.snapToCenter;
target.xspeed = 0;
target.yspeed = 0;
// set the onPress handler for the target
target.onPress = function(){
this.startDrag(this.snapToCenter);
// track the speed of the target
this.onEnterFrame = function(){
this.oldX = this.newX;
this.oldY = this.newY;
this.newX = this._x;
this.newY = this._y;
}
// make the dragging smooth
this.onMouseMove = function(){
updateAfterEvent();
}
}
// handle the releasing of the target
target.onRelease = function(){
this.stopDrag();
// set the new speed of the target
this.xspeed = (this.newX - this.oldX) * this.accel;
this.yspeed = (this.newY - this.oldY) * this.accel;
// let the target ease with friction
this.onEnterFrame = function(){
this._x += this.xspeed;
this._y += this.yspeed;
this.xspeed *= this.friction;
this.yspeed *= this.friction;
if (Math.abs(this.xspeed) < .1 && Math.abs(this.yspeed) < .1){
this.onEnterFrame = undefined;
}
}
// turn off the mouseMove handler
this.onMouseMove = undefined;
}
// set up the releaseOutside handler as well
target.onReleaseOutside = target.onRelease;
// hide and stash the behavior clip
this._visible = false;
this._x = -1600;
this._y = -1600;
}
// register the class
Object.registerClass("throwBehavior", ThrowBehaviorClass);
#endinitclip
Thanks
Throw A Ball Away From Me
Can anyone point me to some code to simulate throwing a ball away from me.. ie the ball should initialy rise and and fall as gravity gets hold while all the time getting smaller as it goes away from me
I've tried this myself and I can get the ball to do roughly as I would like.. but it does not look 'right' (I think the ball drops away too soon)
anyone ?
Throw Them To Different Directions
I want to create a clip in which the balls (of different colors)are thrown to different directions(random(180)) each time I click I button..How can I do this ?
thanks
*picks Something Up And Throw It* HELP PLEASE
need someone to look at these fla's for me. I have searched all over the place for an answer and I have tried some silly things to get it to work but nothing seems to work.
Basically I have Main.swf which loads a scrollpane, content of the scrollpane has buttons. You click on the button and it loads an external swf (poster.swf) onto the main.swf. The position of poster.swf when loaded is x=0 and y=o.
I want this position to be x=156 and y=26. But I can't seem to get it to load to this location.
Any help will be great.
Thanks
Trent
click here to download the fla files
Throw,catch Set And Get In AS2
does like in java there are execeptions in AS2,using throw,catch?
does he set get method exist?
if yes can any 1 reffer to examples?
thnaks in advance
peleg
Throw Stick Man (help)
i want to make a flash where i can pickup a stick man by his legs, arms, and head and be able to swing and throw him around.
im not too good with coding but im willing to learn. also once we get the basics if i can push a button and make another stick man appear and when he hits the walls/floor blood squirts out.
thanks in advance. if u want to help me out personally hit me up on aim:a1i954
[CS3] Throw Me A Bone...
Hi all,
I'm new to Flash and concerned that I may have dropped myself in the 'you-know-what' so if anybody could give me a little bit of advice I would be most grateful.
I have designed a navigation device which looks like a thermometer:
Basically I want the user to mouse over the thermometer, the mercury will move up and down and at predetermined points on the thermometer, images (with a description underneath) will appear. When the user moves away from the thermometer and clicks on the image, it will take the user to another page.
I'm screwed right?
Throw And Collide AS3
I'm trying to basically duplicate this in AS3 http://www.actionscript.org/showMovie.php?id=211.
I want balls/squares to move on the stage and collide with eachother when they hit. But, I also want the ability to interact and throw each ball. Is there an already made AS3 version which uses classes?
I have a AS3 class that throws one ball and also a class that does multiple object collision. I can't seem to get both to work together. For example when I tried combining them, on mouseDown, all the balls would stop (not just the one I'm touching.) and they would keep the same physics as they had before I "stopped" them.
I know there's been a lot of physics and throwing stuff done, but most of it seems to be for AS2. Any advice on doing this in AS3? I can post the two classes I have if it helps.
Thanks!
Throw And Collide AS3
I'm trying to basically duplicate this in AS3 http://www.actionscript.org/showMovie.php?id=211.
I want balls/squares to move on the stage and collide with eachother when they hit. But, I also want the ability to interact and throw each ball. Is there an already made AS3 version which uses classes?
I have a AS3 class that throws one ball and also a class that does multiple object collision. I can't seem to get both to work together. For example when I tried combining them, on mouseDown, all the balls would stop (not just the one I'm touching.) and they would keep the same physics as they had before I "stopped" them.
I know there's been a lot of physics and throwing stuff done, but most of it seems to be for AS2. Any advice on doing this in AS3?
Here's the classes separate from each other.
Both classes use the ball class:
PHP Code:
package { import flash.display.Sprite; import flash.display.*; public class Ball extends Sprite { public var radius:Number; private var color:uint; public var vx:Number = 0; public var vy:Number = 0; public function Ball(radius:Number=20, color:uint=0x000000) { this.radius = radius; this.color = color; init(); } public function init():void { graphics.beginFill(color); //graphics.lineStyle(5, 0x0000FF, .5); graphics.drawRect(-radius/2, -radius/2, radius, radius) graphics.endFill(); //this.x = -this.width/2; //this.y = -this.height/2; } }}
Here is the throw class:
PHP Code:
package { import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; import flash.events.MouseEvent; public class Throwing extends Sprite { private var ball:Ball; private var vx:Number; private var vy:Number; private var bounce:Number=-0.7; private var gravity:Number=.5; private var oldX:Number; private var oldY:Number; public function Throwing() { init(); } private function init():void { stage.scaleMode=StageScaleMode.NO_SCALE; stage.align=StageAlign.TOP_LEFT; ball=new Ball ; ball.x=stage.stageWidth / 2; ball.y=stage.stageHeight / 2; vx=Math.random() * 10 - 5; vy=-10; addChild(ball); ball.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown); addEventListener(Event.ENTER_FRAME,onEnterFrame); } private function onEnterFrame(event:Event):void { vy+= gravity; ball.x+= vx; ball.y+= vy; var left:Number=0; var right:Number=stage.stageWidth; var top:Number=0; var bottom:Number=stage.stageHeight; if (ball.x + ball.radius > right) { ball.x=right - ball.radius; vx*= bounce; } else if (ball.x - ball.radius < left) { ball.x=left + ball.radius; vx*= bounce; } if (ball.y + ball.radius > bottom) { ball.y=bottom - ball.radius; vy*= bounce; } else if (ball.y - ball.radius < top) { ball.y=top + ball.radius; vy*= bounce; } } private function onMouseDown(event:MouseEvent):void { oldX=ball.x; oldY=ball.y; stage.addEventListener(MouseEvent.MOUSE_UP,onMouseUp); ball.startDrag(); removeEventListener(Event.ENTER_FRAME,onEnterFrame); addEventListener(Event.ENTER_FRAME,trackVelocity); } private function onMouseUp(event:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_UP,onMouseUp); ball.stopDrag(); removeEventListener(Event.ENTER_FRAME,trackVelocity); addEventListener(Event.ENTER_FRAME,onEnterFrame); } private function trackVelocity(event:Event):void { vx=ball.x - oldX; vy=ball.y - oldY; oldX=ball.x; oldY=ball.y; } }}
And here is the multiple collision class:
PHP Code:
package { import flash.display.Sprite; import flash.events.Event; public class Bubbles2 extends Sprite { private var balls:Array; private var numBalls:Number=30; private var bounce:Number=-0.5; private var spring:Number=0.05; private var gravity:Number=0.1; public function Bubbles2() { init(); } private function init():void { balls=new Array ; for (var i:uint=0; i < numBalls; i++) { var ball:Ball=new Ball(Math.random() * 30 + 20,Math.random() * 0xffffff); ball.x=Math.random() * stage.stageWidth; ball.y=Math.random() * stage.stageHeight; ball.vx=Math.random() * 6 - 3; ball.vy=Math.random() * 6 - 3; addChild(ball); balls.push(ball); } addEventListener(Event.ENTER_FRAME,onEnterFrame); } private function onEnterFrame(event:Event):void { for (var i:uint=0; i < numBalls - 1; i++) { var ball0:Ball=balls[i]; for (var j:uint=i + 1; j < numBalls; j++) { var ball1:Ball=balls[j]; var dx:Number=ball1.x - ball0.x; var dy:Number=ball1.y - ball0.y; var dist:Number=Math.sqrt(dx * dx + dy * dy); var minDist:Number=ball0.radius + ball1.radius; if (dist < minDist) { var angle:Number=Math.atan2(dy,dx); var tx:Number=ball0.x + Math.cos(angle) * minDist; var ty:Number=ball0.y + Math.sin(angle) * minDist; var ax:Number=tx - ball1.x * spring; var ay:Number=ty - ball1.y * spring; ball0.vx-= ax; ball0.vy-= ay; ball1.vx+= ax; ball1.vy+= ay; } } } for (i=0; i < numBalls; i++) { var ball:Ball=balls[i]; move(ball); } } private function move(ball:Ball):void { ball.vy+= gravity; ball.x+= ball.vx; ball.y+= ball.vy; if (ball.x + ball.radius > stage.stageWidth) { ball.x=stage.stageWidth - ball.radius; ball.vx*= bounce; } else if (ball.x - ball.radius < 0) { ball.x=ball.radius; ball.vx*= bounce; } if (ball.y + ball.radius > stage.stageHeight) { ball.y=stage.stageHeight - ball.radius; ball.vy*= bounce; } else if (ball.y - ball.radius < 0) { ball.y=ball.radius; ball.vy*= bounce; } } }}
Obviously, in order to combine them, some of the code would have to be changed. I'm just not sure what though. Also, I'm not sure if start/stop.drag is the best way of doing this or not.
How To Throw A Movieclip?
Is there some sort of way so i could click on a movie clip and "Throw" it across the stage?
Does anyone have any tutorials?
I don't want any gravity things, just wanna throw the movie clip across the stage
Downloading Throw Flash
A)How can I link a button to an external mp3 file(for example)?
B)If the above is possible how do I make the file to be downloaded without being runed?
Thanks...
Throw Me A Bone Here, People...
I'm trying to create an adjustable menubar like the one found in Outlook Express. The table would feature adjustable columns by dragging on the column spacer between column titles. When you click and drag a spacer, the column to the left would increase or decrease in width and the rest of the columns to the right would slide over.
I've only found adjustable windows so far. Once I get this, I'll post it for everyone. Any help would be greatly appreciated.
rob
Arrays Throw Me In Disarray
Does anybody know of a bug concerning Arrays?
I have 2 dimensional arrays and and as I recompile them, Flash seems to **** up everytime. At least the Debugger. Could the debugger be bugged?
Let me know what you think,
Throw Object With Friction
Hi all,
I want to toss an object against the side of the movie and have it stop there. I can't figure out how to do it so that no matter where the user picks up the MC and releases it it works. I tried recording onclick where the MC was and then detecting where they released and moving in that direction. It works but if they pick it up and move it somewhere else the MC doesn't work. can anyone help or point me to a resource? Thanks!
How Can Adress Var Throw Levels? How
My Problem i load a guestbook in a mainfilm:
Mainfilm Level 0
"load movie"
Guestbook level 1
the problem is that the guestbook load a php script from the server and the guestbook movie cant load the php script when it is in the level 1. have somebody i idea how can solve this problem
please i need really help i have no idea.
i tried to put the load php in the main (leve 0) film but with no result
Throw Away That Array, Use A MC SongList Instead...
Well, laziness is the mother of invention. I am lazy when it comes to typing. If it's one thing I hate more than typing a word, it's typing two of them. And anyone who has typed out an array, knows what I mean. So, I have come up with this new way to play a streaming song list without the array. And, hey, it works. LOL
Make it as long or as short as you want. Start it with a button, or onLoad or on a frame. Stop when done, or with a button. Jump to any song in the list if you want. Check out the FLA, you'll see.
Pick Up And Throw A Movieclip
Hi there!
I'm searching for three days now, but I can't find a tut or fla anywhere on the next subject:
I want to pick up a movieclip with the mouse by pressing the mousebutton and start dragging it, but on the release of the button the movie has to move in the direction and with the speed of the mouse at that moment and slow down with friction.
Someone please?????
thnx in advance!
Im Going To Throw My Computer Off A Balcony
I cannot believe how glitchy and retarded flash is.
This has NEVER happened to me, and I'm sure this problem will go away once it's too late and I've missed a deadline.
VERY SIMPLE CODE!
Code:
Stage.showMenu = false;
Stage.align = "lt";
Stage.scaleMode = "noScale";
function init():Void
{
trace(Stage.height);
controlBar._y = Stage.height - 20;
}
init();
I have my stage height set to 400.... but, for some odd reason, it traces as 300. WHAT THE HELL?!?!!
I hate flash... I hate it.
3d Dice Throw, Physics
Wondering if anyone has been able to make a 3d dice throw that looks believable with a a homebrew 3d physics enginem, wow3d or some other engine
Ive tried wow3d and bolt3d, but i can't seem to make cubes that are rigid.
Anyone got any tips?
Throw The Knife Dangit
I am creating and far into a game in flash 8. it is a sidescrolling game but I am having trouble with the character throw a knife when you hit the space bar. when the game is loaded and no buttons are touched it works great (it flys throw the air and kills the enemy hit area i have set up) but when the left or right arrow keys are hit (to make it apeear that he is walking around) and you hit the space bar afterward(to make the dagger fly through the air and kill the enemy) the frames to play that make the dagger look like its been thrown and is flying through the air but when it comes in contact with the enemy it does not play the frame that makes it die. I need some insight!
BAH Ready To Throw Computer Out The Window
OK, here's the skinny. I've made a menu. EXTREMELY simple menu. I've scripted so that the buttons in the menu, when clicked, SHOULD load a page into the main frame of an HTML frameset. I have used this EXACT method before, but for some reason right NOW it doesn't want to work. This is what the script looks like I've used on a button (there are 5 buttons total, all the same, just different html pages associated):
on (release) {
getURL ("about.htm", "main");
}
OK. So there you go. Easy, right? I don't know what the hell is going on! *breathing deeply* lol.
The script is in the "down" frame of the button as an Object Action. There is no other script associated with this object or the frame it's in.
Can someone PLEASE tell me what's wrong with this...if anything?
Thanks so much!
Rotate Dial With Throw Effect
Does anyone know of a good tutorial which illustrates a dial rotating with a throw effect?
I am very eager to learn this one. If anyone knows. Thanks
Using Value Variables Throw Public Functions
He all!!
I'm trying to use value variables throw public functions in the same class.
Is there any possible to do it?
I'll explain:
Imagine we have a class name Mp3Player that plays some mp3 file and get is ID3 songName:
In that class we have the package:
Quote:
package Mp3Player{
import flash.media.Sound;
import flash.media.SoundLoaderContext;
import flash.media.SoundChannel;
import flash.media.ID3Info;
import flash.net.URLRequest;
import flash.events.Event;
public class Mp3Player {
private var sound:Sound;
private var req:URLRequest;
private var context:SoundLoaderContext;
private var channel:SoundChannel;
private var id3:ID3Info;
private var nomeMusica:String;
Then we have the public class to load and play the mp3 file passed using argument "file":
Quote:
public function tocarMusica(file) {
sound=new Sound ;
req=new URLRequest(file);
context=new SoundLoaderContext(8000,true);
sound.load(req,context);
channel=sound.play();
sound.addEventListener(Event.ID3,setNome);
}
After we load and start play the mp3 file, we whant to get the ID3 songName and save it in the "nomeMusica" variable:
Quote:
public function setNome(event:Event) {
id3=event.target.id3;
nomeMusica=id3.songName;
trace("Nome: "+nomeMusica);
}
Now the problem is...How can i trace(nomeMusica) outside the "public function setNome(event:Event)"?
Or in other words:
In the FLA file i can call to play the mp3 file like this:
Quote:
var musica = new Mp3Player();
musica.tocarMusica("song.mp3");
And how can i call the ID3 songName using sometinh like:
Quote:
musica.getName();
Sorry my english and i hope you can help me in a simple way.
Throw An Array As Function Parameters
Hello all!
I just want to know if it's possible to throw an array as function parameters,
because if it isn't possible I have to do it like this:
ActionScript Code:
if( params.length == 1 ) mc[ function ]( params[ 0 ] );
if( params.length == 2 ) mc[ function ]( params[ 0 ], params[ 1 ] );
if( params.length == 3 ) mc[ function ]( params[ 0 ], params[ 1 ], params[ 2 ] );
And I just want to do it like this:
ActionScript Code:
mc[ function ]( params );
Someone knows if it's possible?
Thnx!!
Throw Error On Improperly Formatted XML?
I want to use my custom MsgBox class to throw a msg if xml is formatted incorrectly going into flash.
I have a bunch of xml calls that are all generated server side and taken care of by someone else. I want to be able to catch when xml is formatted incorrectly (because of an error on his end) and be able to tell him what is messed up.
the msg part i can figure out, just need to know how to find out if xml is formatted correctly...
is there something as simple as... XML.isValid hahaha. probably not...
thanks
Throw Boxes On Stage That Don't Hit Each Other, HitTest...
Hi all!!
I have 5 invisible boxes outside my stage 3 of which i want to throw inside the visible area and shouldn't hit each other.
My way is with hitTest. Firstly i throw the first box on stage.
Then i check a random number from 0 to 1 and place one of the two second boxes on stage while it doesn't hit the first.
Then i check a random number from 0 to 1 and place the third box while it doesn't hit the other two
So the first box has this code on it:
ActionScript Code:
onClipEvent (load){
_x= random(665)+ 65;
_y= random(250)+ 250 ;
}
the second has this:
ActionScript Code:
onClipEvent (load){
if(_global.building30 == 1){
do {
_x= random(665)+ 65;
_y= random(250)+ 250;
} while (this.hitTest(_root.ta0)==true)
}
}
and the third box has this:
ActionScript Code:
onClipEvent (load){
if(_global.building60 == 1){
do {
_x= random(665)+ 65;
_y= random(250)+ 250;
} while (this.hitTest(_root.ta0)==true&&this.hitTest(_root.ta30a)==true&&this.hitTest(_root.ta30b)==true)
}
}
Is my thinking wrong because this doesn't seem to work every time! ! ! !
A copy of the program is here
I don't want the boxes to interact at all.
the "boxes" are the target areas that the houses have to be put on. And i don't want one house in front of another so an area if front of another. My areas are movie clips that consist of a line and an invisible rectangle approximately the size of the house.(i made it like this because with hit test when one movie clip goes in front of another the hitTest method is triggered)
Every time you hit the red button the areas are repositioned randomly.
please help!
Using Value Variables Throw Public Functions
He all!!
I'm trying to use value variables throw public functions in the same class.
Is there any possible to do it?
I'll explain:
What i whant is in tha FLA file to get the songName of the mp3 like trace(musica.nomeMusica);
quote://AS Code
package Mp3Player{
import flash.media.Sound;
import flash.media.SoundLoaderContext;
import flash.media.SoundChannel;
import flash.media.ID3Info;
import flash.net.URLRequest;
import flash.events.Event;
public class Mp3Player {
private var sound:Sound;
private var req:URLRequest;
private var context:SoundLoaderContext;
private var channel:SoundChannel;
private var id3:ID3Info;
private var nomeMusica:String;
public function tocarMusica(file) {
sound=new Sound ;
req=new URLRequest(file);
context=new SoundLoaderContext(8000,true);
sound.load(req,context);
channel=sound.play();
trace("A tocar");
sound.addEventListener(Event.ID3,id3Info);
}
public function id3Info(event:Event):void {
id3=event.target.id3;
nomeMusica=id3.songName;
}
public function get getNome():String {
return nomeMusica;
}
}
//FLA Code
import Mp3Player.Mp3Player;
var musica:Mp3Player = new Mp3Player();
var nome:String = musica.getNome;
musica.tocarMusica("Saia_Indiscreta.mp3");
trace(nome);
}
The trace of my code is:
quote:A tocar
Null
What i'm doing wrong or is missing?
Beach Ball Hold And Throw?
I am looking to create a beach ball on my stage that I can grab and as i have my mouse button down, the ball follows the mouse. I know i can do that with startDrag();.
What i am having a problem with is when i release the mouse it goes flying into the "wall" in the direction i throw it and then bounce off of it.
any ideas?
How To Throw An Error When No Netstream Connection?
I'm trying to make a simple webcam recorder. This code works, but it doesn't tell you when/if there's something wrong. It just "goes".
1) So, how can you detect when there is no connection established to the RTMP server? I'd like to display something like "connection cannot be established" when there is a problem.
2) How can you figure out if there is actually a camera attached? I get a "allow access to your camera and microphone?" prompt whether or not a camera is actually attached. I'd like to display something like "no camera detected" if there is a problem finding a camera.
Thanks, and here's the code:
Actionscript Code:
// create basic netConnection object
var conn:NetConnection = new NetConnection();
// connect to the local Red5 server
conn.connect(appDirectory);
// create the netStream object and pass the netConnection object in the constructor
var stream:NetStream = new NetStream(conn);
// get references to the camera and mic
var cam:Camera = Camera.get();
var mic:Microphone = Microphone.get();
// setup some simple settings with the cam and mic for quality
setupCameraMic();
function setupCameraMic():Void
{
// setup cam
cam = Camera.get();
// setting dimensions and framerate
cam.setMode(320, 240, 30);
//cam.setQuality(25600, 85);
cam.setQuality(0, 85);
// set keyframes--120 if at 30fps
cam.setKeyFrameInterval(120);
//cam.setMotionLevel(30, 500);
// attach the cam to the videoContainer on stage so we can see ourselves
videoContainer.attachVideo(cam);
// setup mic
mic = Microphone.get();
mic.setRate(44);
mic.setGain(75);
}
|