Drawing Object
Can anyone tell me why I can not get the DRAWING OBJECT box to show. I want to adjust the size of a retangle box that I have drawn. WHen I watch Lee draw a box using the rectangle tool, the drawing object box appears in the property inspector with a box for height and one for width. When I draw a rectangle using the same rectangle tool I don't get a box to adjust the box size. When I draw a rectangle I see "properties" "parameters" and "filters" and underneath I see only the words "rectangle tool" If I double click the rectangle I get a cross hatch pattern then I can adjust size but I can not move the newly sized rectangle anywhere. ANy Ideas?? anyone?? THanks in advance !Alyn
General Flash
Posted on: Sun Oct 08, 2006 5:28 pm
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Drawing An Outline Of An Object In Flash And Then Animating The Drawing?
I wish to draw an outline of an object in flash? bit by bit a piece of the outline is drawn until the outline is completed, once this has finished then object then appears and the outline disppears (this part I can manage).
I do not know where to begin? So may need a lot of direction on this one.
Cant Tell When Merge Drawing Model Vs. Object Drawing Model
I keep drawing shapes on the same layer, overlapping them, and then trying to delete one of the shapes to cut a shape out of the first. This does not work automatically as Help says it does, I have to go to "Modify > Combine Objects > Union" to merge them, THEN I can cut my shape out. When is this supposed to occur "automatically"? How am I supposed to know what mode I'm in?
Cant Tell When Merge Drawing Model Vs. Object Drawing Model
I keep drawing shapes on the same layer, overlapping them, and then trying to
delete one of the shapes to cut a shape out of the first. This does not work
automatically as Help says it does, I have to go to "Modify > Combine Objects >
Union" to merge them, THEN I can cut my shape out. When is this supposed to
occur "automatically"? How am I supposed to know what mode I'm in?
Object Drawing Model / Merge Drawing Model
Recently I reinstalled Macromedia Flash 8, but then it was installed with the "Merge Drawing Model" instead of the "Object Drawing Model". How do I change this?
I've tried to read this, but it doesn't say exactly what to do;
http://livedocs.adobe.com/flash/8/ma...=00000486.html
Thanks
-JPAG
Drawing Object...
i intend to do a drawing object that i can draw a line, circle and erase my drawing.
My "line" button cannot work.
Let's say if i click "line" button, i drag my mouse then the line will appear follow my drag cursor.
If i click the "oval" button,i drag my mouse on stage .A oval will appear.
Anyonw who know pls help...
thankx
Drawing Object
Just wondering why .... when I draw a simple rectangle object it seems to automatically turn into a symbol-like object. IE, I have to click into it to edit it. This doesn't happen for me at work.. just at home. same flash version. ????
thanks
Drawing Object - Help
Ok - this is really daft .. Every time I create a shape, it becomes a 'drawing object' with a MC like blue lined box around it ... Unlike the default 'boxless' shapes ... What on earth I have clicked to make this start happening?! I don't want it - AND I want to know how to make drawing a shape just like Normal!
...please
Object Drawing
I don't get 'object drawing' I know it has to do with grouping.. But why not just use the normal shape option why use 'object drawing' with it ? what purpose does it serve ?
Drawing Lines With Another Object
Hi!
I've managed to get a small grey ball to move around the screen in a certain way but I'd like it to draw a permanent line behind it as goes, any ideas how i'd do this?
Many thanks, Hannah
Can't Move A Drawing Object
Code:
this.createEmptyMovieClip("triangle_mc", 1);
triangle_mc.beginFill(0x0000FF, 30);
triangle_mc.lineStyle(5, 0xFF00FF, 100);
triangle_mc.moveTo(200, 200);
triangle_mc.lineTo(300, 300);
triangle_mc.lineTo(100, 300);
triangle_mc.lineTo(200, 200);
triangle_mc.endFill();
triangle_mc._x=50;
I have a problem! I can't move the mclip triangle_mc to the x=50 coordonate. Please help me!
Drawing On Top Of A Display Object
Hi all!
I want to draw lines on top of a display object using the Graphics class.
In the lineTo() documentation it says:
"If the display object in which you are drawing contains content that was created with the Flash drawing tools, calls to the lineTo() method are drawn underneath the content."
I get the same effect when I draw the object with action script.
So my question is, whether is a way to work around this and draw on top of
a display object (a rectangle for example)?
Thanks in advance!
Joost
Drawing On Top Of Display Object
Hi all!
I want to draw lines on top of a display object using the Graphics class.
In the lineTo() documentation it says:
"If the display object in which you are drawing contains content that was created with the Flash drawing tools, calls to the lineTo() method are drawn underneath the content."
I get the same effect when I draw the object with action script.
So my question is, whether is a way to work around this and draw on top of
a display object (a rectangle for example)?
Thanks in advance!
Joost
Drawing Object Mode
I draw two ovals on stage, and I double click on one of the ovals and it
brings me to Drawing Object mode. I did not make this into a symbol, so
I am confused as to where I am? Is this still part of the stage, or will
changes made here not affect what is on my stage?
Thanks!
Simulate Drawing And Object
I'd like to make an object look like it is being drawn as part of the flash animation. Like say i have a square. I want to make it look like it is being drawn from upper left corner to lower left to lower right to upper right back to upper left. I'm not even sure if I am describing the correctly.
Jason
Settings Changed, Everything Becomes A Drawing Object
I just open flash today and make a Circle, an noticed that everything that I put on the artboard is changed to a Drawing Object by default so I have to either break it apart or double click everything before I can edit. Now I didnt change this setting so I have no idea where this setting can be found or how to reverse it
Anyone here know?
Thanks in Advance
Mark Hollas
Object Drawing Mode Question
Hi, Im using flash 8 but my 'object drawing mode' button has disappeared from the 'options' panel in the tool bar. when i select a drawing tool (oval or rectangle'. It was there yesterday but now its gone. Its currently set to object drawing mode on but I want to turn it off as I think this is what I need to be able to draw with the line tool and have the lines connected together. Please help!!
Allways Creating 'Drawing Object'...
Hi there.
When I'm drawing in flash, it allways creates a "Drawing Object" out of the lines. This is really annoying, and I have probably just activated it by accidentally hitting the hotkey for it.
Anybody who knows how to turn it off?
Thanks
Updating Part Of A Drawing Object?
I'm creating a project where I'm dynamically placing a number of movie clips on the stage, getting information from an XML file about which other MCs they are related to, and drawing lines connecting the MCs that are related to one another.
That part is working fine. What I want to do now is I am animating the MCs so that they move a certain amount onEnterFrame. I want to update the connecting lines as the MCs move, but since I am moving them individually, I need to update the connectors one by one. I can't figure out how to only clear the lines that are drawn from the MC that is currently being moved. If I clear the whole canvas, you only see one line being updated.
I hope this makes sense. Is what I'm trying to do possible, and if not, is there another approach I can use?
Thanks!
Disable Drawings Put Into A Drawing Object
hello
in Flash CS3, when you draw anything it automatically puts this into a drawing object which is just stupidly annoying. how do i disable this???
Anyone know??
Thanks
Capturing Drawing As A Shared Object
I am trying to create an online interactive whiteboard application and I have been following the tutorial found at:
http://www.macromedia.com/devnet/mx/...hiteboard.html
I am able to capture lines using starting and ending points as illustrated in the tutorial "drawing with lines", but I need to capture the freehand, like the one on page 4 of the tutorial "drawing with segments":
http://www.macromedia.com/devnet/mx/...teboard_4.html
Is there a way to continuously create starting and ending points, so that the complete drawing is shown istantaneously?
Any help is greatly appreciated.
Thanks
Converting A Shape Into A CS3 Drawing Object
Hello!
I've noticed that when I draw, say a square, in CS3, it becomes a "Drawing object" (like a symbol that doesn't appear in the library), instead of a pure shape like in Flash 8.
But let's say I break a drawing object down into a shape, how do I convert this shape back into a drawing object?
I like drawing objects, they're cool for simple shapes that I don't want in my library, and that I don't want to get distorted like pure shapes (despite being placed at integer positions) particularly in large documents.
Anybody know?
Thanks,
Kyrre
Converting A Shape Into A CS3 Drawing Object
Hello!
I've noticed that when I draw, say a square, in CS3, it becomes a "Drawing object" (like a symbol that doesn't appear in the library), instead of a pure shape like in Flash 8.
But let's say I break a drawing object down into a shape, how do I convert this shape back into a drawing object?
I like drawing objects, they're cool for simple shapes that I don't want in my library, and that I don't want to get distorted like pure shapes (despite being placed at integer positions) particularly in large documents.
Anybody know?
Thanks,
Kyrre
[CS3] Make Button From Drawing Object Group
I have used adobe illustrator to create a vector graphic which is the word "CATALOGUE DOWNLOAD" as I can only get the style I want in illustrator.
I then paste this into Flash CS3 and try to make it a button by doing the following:
- I make a square button over the text with alpha value 0% - this is to stop every character from being a separate part of the button. This works.
- Problem is I want to have an underline as the hover over for the button - Everytime I try and do this, I run the SWF and it never appears. The see through square is making the underline invisible also.
Please suggest how I would tackle this.
Thanks anyone
Drawing Colored Lines Using The Graphics Object
Mornin,
Trying to draw lines dynamically and having difficulty adding color to the lines. The code works fine except for the two lines with <---????? commented after them. They do not produce errors but I was hoping that they would cause the line that I was drawing to be color = 8 instead of black.
thanks!
ActionScript Code:
// First we declare our movieclip object, this is kind of a container for our drawing,
// and we define how to refer to it (my_line).
var my_line:MovieClip = new MovieClip();
// here we attach our line movieclip to the main stage using the addChild
addChild(my_line);
// Now we give our line some properties, this is just to tell flash that we want our line thickness to be 4
my_line.graphics.lineStyle(4);
//-------------------
//This is the part that I am unsure about I need to set the color of the line
//here but is this the correct method? I know not
my_line.graphics.beginFill(8); //<--------?????
// Here is another property, here we define the first starting point of the first line, (x and y axis)
my_line.graphics.moveTo(5,5);
//Draw the line
my_line.graphics.lineTo(60, 90);
//-------
//Unsure about this too
my_line.graphics.endFill(); <--?????
Why Doesn't Object Drawing Mode Stay On?
Even when I draw shapes using Object Drawing and leave it turned on, some shapes will randomly act as though I'm using Merge mode. For example, if I marquee-select several shapes on a layer and apply a shape tween, some of the objects will become split where I dragged the marquee box and the parts will do their own, separate tweens.
Am I doing something wrong or is this just another quirk?
No "merge/object Drawing" Button On The Toolbar?
Hi, I'm a new Fl CS3 Pro user, and I can't locate the "object drawing on" button... It's not that I'm a noob, it's actually not there; is it some sort of compatibility issue or an item I removed from the bar? Is there any way to bring it back?
Thanks heaps in advance
Flash 8 Auto "drawing Object"
hey its been a long while since i did anything in flash, just got 8, and a new feature which i figure must be useful to soemone is the automatic conversion of stuff i pen or circle or box to "drawing objects"
how do i turn this stupid feature off ? I mean, does anyone else find this nauseating ?
lol. sorry, update :
its a button you have in the drawing settings. goober strikes again !!
Scrolling Drawing Board? Drawing Without Moving The Mouse
Hello, I'm new to this board and kind of a flash newbie so you could probably help me out.
What I'm trying to build is what you could call a scrolling drawing board - just like a drawing board but when the mouse comes close to the edge of the window, it scrolls and lets you continue your drawing.
I have no problem creating a drawing board with API, but i can't make it scroll. Usually when i want to scroll a background image i make it move along with the mouse when the cursor is near the edge of the window (for example, if the mouse's coordinates are above a certain number, the background image starts moving in one direction so it "scrolls" in the other direction).
So i wanted to do this with the movieclip of the drawing in a drawing board (make it move according to mouse's coordinates near the edge of the window), but when i scroll i have to stop the mouse at the edge of the window because i cant go any further :p so the drawing moves but it stops drawing. Or maybe what i need is some way to draw even when the mouse is not moving. Is that possible?
I'm sorry it may seem a bit confused (moreover english isnt my native langage :p), I'll try to post an example later. In the meantime, if any of you see how i can do that ... thanks
Drawing Board With Specific Section For Drawing
Ive made myself a drawing board in flash, but the problem is that i can draw over anything on the stage and I want to have a specific canvas for drawing.
I tried creating a separate MC and pasting the code there but it didnt help although i have no idea why. Any ideas?
Drawing Scripts For A Drawing Program
Need help with reference scripts for a simple drawing program. I'd like the user to be able to select different tools (circle, square, pencil, paint brush), change the color of the fill, and erase or reset the screen. Can anyone refer me to the right place?
Drawing A Soft Mask... Drawing Api?
Hello everyone, (almost) first post here
I'm creating a, quite original flash website (meh... not my idea in fact, I'm only the flasher!), in wich you're in a car, sitting on the passenger side, and you're looking outside to see the contents coming on the road.
It rains.
A lot.
So the windowseat is "fogged" (how can I say that...???) and while you're loading the content you actually can draw on the glass with your.. err... finger (mouse!), like how your friends usually do in your car when you really don't want their fingerprints all over your car glass
Ok, easy way to do that:
1 - attachmovie
you actually duplicate a circle, give it some randomness in blurring and size so it looks irregular and place it right under your mouse.
Good, it works... but when you move fast, it just leaves a blank spaces between clip and clip...
Hey... that's not fair...
2 - drawing api
Oh my god... I can't make a mask with a simple line, so I should draw a shape while moving the mouse.
The point is... HOW???
I dunno if there's a better way to do that, but that's the only one in my mind now.
Actually the drawn clip should also be blurred a little bit (1 or 2 percent) wich is not a problem since you can easily blur the container.
But now the real point is: how do I draw like that with the beginfill?!?!?
Note: I uploaded the fla so you can have an idea on how it looks...
Help Needed In AS3 Drawing Board ( With Drawing Api)
Hi all,
I'm doing a flash application with flash cs3 actionscript3. I tried with as2.
Now I am facing difficulty in doing it in AS3.
the application includes:-
all the vector or images should be editable means scale rotate color change etc.
draw line -
draw rectangle -
circle
input text.
curve with node points
if anyone have any tutorials or any resourse please post here.
thanks inadvance
Harish
[MX04] "Drawing" Line Effect Using Drawing API
So i've got a basic drawing using the drawing API ala:
myLine = this.createEmptyMovieClip("newLine", 1);
myLine.lineStyle(3, 0x000000, 100);
myLine.moveTo(0,0);
myLine.lineTo(100,0);
myLine.lineTo(100,100);...etc
Now is there a way to have flash animate the drawing of the lines like a map from an Indiana Jones movie?
Thanks!
Drawing Api Drawing Saving
ok - say i have made a swf where you can draw, with possible color change and different brush size, and i want to somehow save my drawing (in a database)
so i figured every little line that is drawn on enter frame has 6 values - start x, start y, end x, end y, color and size.
approximately - first 4 are 3 numbers, color is 6 numbers and size is 2 numbers length, so its 4*3+6+2=20 numbers for one little line
the framerate of the movie is 100fp/s so getting the maximum smoothness of the drawing, so one little line is drawn in 1/100 of a second, and in a second i have to save 20*100=2000 numbers.
a symbol is 8 bytes, so 2000*8=16000 bytes (/1024~15,5kb) - in a second!
so if you draw for a minute - its 16000*60=960'000 bytes (/1024~937,5kb~1mb) in a minute!
and my question is how to save a drawing to a database different way then im thinking, to me this seems the only way...
1mb per minute of drawing seems kinda lame for me and noone will want to wait till it loads up
Drawing Api Drawing Saving
ok - say i have made a swf where you can draw, with possible color change and different brush size, and i want to somehow save my drawing (in a database)
so i figured every little line that is drawn on enter frame has 6 values - start x, start y, end x, end y, color and size.
approximately - first 4 are 3 numbers, color is 6 numbers and size is 2 numbers length, so its 4*3+6+2=20 numbers for one little line
the framerate of the movie is 100fp/s so getting the maximum smoothness of the drawing, so one little line is drawn in 1/100 of a second, and in a second i have to save 20*100=2000 numbers.
a symbol is 8 bytes, so 2000*8=16000 bytes (/1024~15,5kb) - in a second!
so if you draw for a minute - its 16000*60=960'000 bytes (/1024~937,5kb~1mb) in a minute!
and my question is how to save a drawing to a database different way then im thinking, to me this seems the only way...
1mb per minute of drawing seems kinda lame for me and noone will want to wait till it loads up
Drawing API - A Line Drawing Itself
I can draw a simple line with the drawing API and I'm able to place it on the stage where I want to but I'm trying to have the line draw itself between x=0 y=0 and x=600 y=400.
Any pointers on how to take that on?
t/y
Making An Object Dissapear Once A Moving Object Makes Contact With It
Hello there,
Im in need of some help. Basically I need a code which will make an object disappear once another moving object hits it (MovieClips controlled by AS)
For example, a bullet comes out of the gun and hits a can which makes the can disappear as soon as the bullet hits it.
Is it something to do with the "intersects" function? I've been trying to solve it all day and cant do it
Please help.
Whats It Called When You Drag An Object And Want The Object To Continue Moving
i am trying to work out how to make a draggable movie clip/button continue to move in the same direction as the drag guides it...hmmmm does this make sense???? what is this function / behaviour called.... i have looked at many many drag tutorials but at present have only managed to find drag and drop type onces with target positions.... also does any one know if it is possible assign multiple drag points.
regards....
Video Object - Call To Load And Listener Object Not Working
i've got a video object within a movieclip who's full path i put in a var called 'video'. here's my code, it appears that the video object is not loading my stream and/or i'm not getting the listener object to work properly... everything does trace out good as far as vars, rtmp address, etc... grrr!!!
Code:
//function to load the stream in the vid object
_global.loadVid=function(vidFile){
trace("this is path to vidObj: "+video);
trace("loadVid function var passed: "+vidFile);
var listenerObject:Object = new Object();
listenerObject.ready=function(eventObject:Object):Void{
//video loaded, do this
video.removeEventListener("ready", listenerObject);
_root.container.vidPanel.gotoAndPlay("tovideo");
trace("video is loaded, proceeding to video play state");
};
video.addEventListener("ready", listenerObject);
var nV:String=rtmpURL+vidFile;
video.load(nV, true);
trace("video: "+rtmpURL+vidFile+" should be loading");
}
How'd U Make An Object Snap 2 Its Original Pos On An Object Thats Moved?
I'm working on a school project using Flash mx that needs a scrolling inventory. I know how to get an object to snap back to its original position from a drag, but how would you get it to snap back to its original position on an object that has moved? ie. On a scrolling menu?
//script to have a spanner remove a head and snap back to position if it doesn’t touch the head on release:
//attach to object
onClipEvent (load) {
spanx = _root.spanner._x;
spany = _root.spanner._y;
}
//action inside clip
on (press) {
startDrag(this,true);
}
on (release, releaseOutside) {
if (this.hitTest(_root.dismantle.head) & _root.head_switch=="hollow") {
_root.spanner.gotoAndPlay(2);
_root.dismantle.head.gotoAndPlay(2);
this._y = 185;
_root.airbrush._x= _root.airbrush.airbx;
_root.airbrush._y= _root.airbrush.airby;
}
else {
_root.spanner.gotoAndStop(1);
this._x = spanx;
this._y = spany;
this.gotoAndStop(2);
}
stopDrag();
}
how would i script a scrolling inventory from which I can drag and drop objects that snap back to the same pos in the inventory even tho its moved? You can see the inventory on the right of the attached jpeg.
Papervision Acsess Individual Object Within .dae File/Object
Hello,
The following code loads a .dae file into a new DAE() Object i am trying to acsess a specific child within de Object called "Loja1" (one of many) with var storeisplayObject3D = holder.getChildByName("Loja1"); to individually rotate it etc... but with no sucsess.
Does anyone know how this is acomplished ?
Thanks in Advance.
files at : http://www.kiyoshii.com/transfer/src.zip
Code:
package {
import flash.display.Sprite;
import flash.display.Stage;
import flash.events.Event;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.parsers.DAE;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.view.Viewport3D;
public class Pulitzer3d extends Sprite {
public var viewport:Viewport3D;
public var renderer:BasicRenderEngine;
public var scene:Scene3D;
public var camera:Camera3D;
public var dae:DAE;
public var cm:ColorMaterial;
public var holder:DisplayObject3D;
public var cameraBtn:BtnCamera;
public function Pulitzer3d() {
init();
}
private function init() {
//basic scene stuff
viewport = new Viewport3D(1024, 768, true,true);
addChild(viewport);
renderer = new BasicRenderEngine();
scene = new Scene3D();
camera = new Camera3D(holder, 15, 100);
camera.zoom = 500;
camera.z = -50;
//COLOR MATERIAL
cm = new ColorMaterial(0xFF0099, .85, true);
//DAE
dae = new DAE();
dae.load("floor_rename.dae", new MaterialsList( { all:cm } ));
holder = new DisplayObject3D();
holder.addChild(dae);
holder.rotationX = 90;
holder.rotationY = 45;
scene.addChild(holder);
var store:DisplayObject3D = holder.getChildByName("Loja1");
trace("DAE : " + store);
stage.addEventListener(Event.ENTER_FRAME, renderStuff);
}
private function renderStuff(e:Event) {
renderer.renderScene(scene,camera,viewport,true);
//camera.x += (((stage.mouseX-(stage.stageWidth * .5))*2)-camera.x )*.05;
//camera.y += (((stage.mouseY-(stage.stageHeight*.5))*2)-camera.y )*.05;
}
}
}
Web Service Param Is An Object Inside And Array Which Is An Object
Howdy. This is my first time on this forum, and I hope I get more help here than some of the other forums. I'll try to explain my dillema as simply as possible.
I have a webservice. I am calling a method 'InsertSlide'. That method requires and object as the paramater.
the object shcema looks like this:
Object
-SlideID (integer)
-Name (integer)
-SlideTypeID (integer)
-Hits (integer)
-LocationID (integer)
-SwfFileName (integer)
-SlideDataCollection (Array)
- -N (Object)
- - -Label
- - -Value
I hope that makes sense, all I'm trying to get at, is there is an object with an array as a property, that array is populated with an object and it has properties.
I recieve that same ojbect from the webservice fine, but when I send that object like that to the Webservice it does not fully populate my databases, unfortunatly I did not write the webservice.
Is it possible that the problem is the webservice? or flash?
Thanks for any help!
- Kiwi
Targeting Object Properties Inside PopUp Object
In my project I am creating a window using the PopUpManager. The symbol used to create that window has several objects.
For the sake of discussion we'll discuss the object message_txt inside myWindow.
How do I reference message_txt.text from actionscript after the object is dynamically created?
Gravity Issue? Object Slides Through Another Object Instead Of Sitting On Top Of It
Hello!
I have a file where two objects fall from the top of the stage and bounce and then eventually stop (using gravity and hit test).
You can grab the objects (a ball and a box --- each has a button symbol n the movie clip) and toss them and they bounce off each other and off the 4 sides of the stage.
The issue is when one of the objects is dropped directly on top of the other object, after it stops bouncing, it slides down until it hits the bottom of the stage (in this case, the box slides down in front of the ball, and the ball slides down in back of the box).
Is this because the gravity is pulling the object down to the bottom of the stage even though there's another object in its way?
How can I fix this so that the objects will still bounce off each other, and when dropped directly on top of each other object will stop instead of oozing through it (sorry, this is the best way I can describe it ?
I've attached 2 files (Fla 8 and Fla mx 2004).
-------- here is the gravity code on the first frame:
PHP Code:
var gravity:Number = 1.2;
var restitution:Number = 0.6;
var friction:Number = 0.9;
stop();
-------- here is the code on the ball
PHP Code:
onClipEvent(load) {
var dragging:Boolean = false;
var vel:Object = { x: 0, y: 0 };
var pos:Object = { x: _x, y: _y };
var old:Object = { x: _x, y: _y };
var radius:Number = this._width / 2;
var movie:Object = { width: 400, height: 300 };
}
onClipEvent(enterFrame){
if( !dragging ) {
vel.y += _root.gravity;
pos.x += vel.x;
pos.y += vel.y;
if( pos.y + radius > movie.height ) {
pos.y = movie.height - radius;
vel.y *= -_root.restitution;
vel.x *= _root.friction;
}
if( pos.x + radius > movie.width ) {
pos.x = movie.width - radius;
vel.x *= -_root.restitution;
}
if( pos.x < radius ) {
pos.x = radius;
vel.x *= -_root.restitution;
}
_x = pos.x;
_y = pos.y;
} else {
old.x = pos.x;
old.y = pos.y;
pos.x = _x;
pos.y = _y;
vel.x = ( pos.x - old.x ) / 2;
vel.y = ( pos.y - old.y ) / 2;
}
if(this.hitTest(_root.box)) {
trace("hit");
// ball and box are colliding, so lets reverse their movements.
vel.x *= -1;
vel.y *= -1;
_root.box.vel.x*=-1;
_root.box.vel.y*=-1;
/* these actions could be made more realistic by determining the precise
position of the ball relative to the box during the collision, for instance,
determine if the right side is colliding with the left side, so only reverse
the x velocity, instead of both. */
}
//this prevents the ball from leaving the upper extreme of the stage
if (this._y < 0) {
vel.y*=-1;
}
}
-------- here is the code on the button inside the ball (so you can drag and release the ball)
PHP Code:
on(press){
startDrag(this,false,16,16,384,284);
dragging = true;
}
on(release, releaseOutside){
stopDrag();
dragging = false;
}
-------- here is the code on the box
PHP Code:
onClipEvent(load) {
var dragging:Boolean = false;
var vel:Object = { x: 0, y: 0 };
var pos:Object = { x: _x, y: _y };
var old:Object = { x: _x, y: _y };
var radius:Number = this._width / 2;
var movie:Object = { width: 400, height: 300 };
}
onClipEvent(enterFrame){
if( !dragging ) {
vel.y += _root.gravity;
pos.x += vel.x;
pos.y += vel.y;
if( pos.y + radius > movie.height ) {
pos.y = movie.height - radius;
vel.y *= -_root.restitution;
vel.x *= _root.friction;
}
if( pos.x + radius > movie.width ) {
pos.x = movie.width - radius;
vel.x *= -_root.restitution;
}
if( pos.x < radius ) {
pos.x = radius;
vel.x *= -_root.restitution;
}
_x = pos.x;
_y = pos.y;
} else {
old.x = pos.x;
old.y = pos.y;
pos.x = _x;
pos.y = _y;
vel.x = ( pos.x - old.x ) / 2;
vel.y = ( pos.y - old.y ) / 2;
}
}
-------- here is the code on the button inside the box (so you can drag and release the box)
PHP Code:
on(press){
startDrag(this,false,16,16,384,284);
dragging = true;
}
on(release, releaseOutside){
stopDrag();
dragging = false;
}
I appreciate any help anyone can give me to fix this issue, I don't understand enough yet about how these objects are interacting to fix this --- but I hope to learn from you brilliant Kirupians!) Thanks!
Hondo311
Tween Class To Move An Object Called From Within The Object
I have a custom class that I want to move with the Tween Class
I am calling the Tween constructor from within that class but when I pass the keyword "this" as the object of that constructor , it doesnt move at all the code is as follow
PHP Code:
package{import fl.transitions.Tween;import flash.display.MovieClip;public class PortViewer extends MovieClip{var _twn:Tween;public function PortViewer(){ _twn = new Tween(this, "y", None.easeNone, 0, 100, 2, true);}}}
how do I reference the object from within itself is there another keyword?
There are no errors it just doesnt move
Thank you Kirupa forums
AS3 - Papervision Acsess Individual Object Within .dae File/Object
Hello,
The following code loads a .dae file into a new DAE() Object i am trying to acsess a specific child within de Object called "Loja1" (one of many) with var store: DisplayObject3D = holder.getChildByName("Loja1"); to individually rotate it etc... but with no sucsess.
Does anyone know how this is acomplished ?
Thanks in Advance.
files at : http://www.kiyoshii.com/transfer/src.zip
Code:
package {
import flash.display.Sprite;
import flash.display.Stage;
import flash.events.Event;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.parsers.DAE;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.view.Viewport3D;
public class Pulitzer3d extends Sprite {
public var viewport:Viewport3D;
public var renderer:BasicRenderEngine;
public var scene:Scene3D;
public var camera:Camera3D;
public var dae:DAE;
public var cm:ColorMaterial;
public var holder:DisplayObject3D;
public var cameraBtn:BtnCamera;
public function Pulitzer3d() {
init();
}
private function init() {
//basic scene stuff
viewport = new Viewport3D(1024, 768, true,true);
addChild(viewport);
renderer = new BasicRenderEngine();
scene = new Scene3D();
camera = new Camera3D(holder, 15, 100);
camera.zoom = 500;
camera.z = -50;
//COLOR MATERIAL
cm = new ColorMaterial(0xFF0099, .85, true);
//DAE
dae = new DAE();
dae.load("floor_rename.dae", new MaterialsList( { all:cm } ));
holder = new DisplayObject3D();
holder.addChild(dae);
holder.rotationX = 90;
holder.rotationY = 45;
scene.addChild(holder);
var store:DisplayObject3D = holder.getChildByName("Loja1");
trace("DAE : " + store);
stage.addEventListener(Event.ENTER_FRAME, renderStuff);
}
private function renderStuff(e:Event) {
renderer.renderScene(scene,camera,viewport,true);
//camera.x += (((stage.mouseX-(stage.stageWidth * .5))*2)-camera.x )*.05;
//camera.y += (((stage.mouseY-(stage.stageHeight*.5))*2)-camera.y )*.05;
}
}
}
|