Attach Object Question
Hi guys, I just wanted to get some information abou the attach movie feature in flash mx, and in particular the "export in the first frame" option. I've created a small movie just for testin pourpose, and I don't want the attached movie to be loaded in the first keyframe, so I unceck the option but at this point the "attach" thing doesn't work! Why is that?? Is there any movie and/or tutorial that explains the thing??
T.i.a Giano
FlashKit > Flash Help > Flash Newbies
Posted on: 07-16-2003, 05:59 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Drag And Attach To Object
I am trying to create some scripting to make an object (bandage) to be draggable, then be able to pickup/stick/attach to another object (an egg)
Here is my swf file. If you look at it, I basically want it to perform the same thing as the embedded movie I put in the swf. I assume there has to be some collision detection, but I dont know where to start. All I have is a draggable bandaid.
Any help appreciated.
Drag And Attach To Object
I am trying to create some scripting to make an object (bandage) to be draggable, then be able to pickup/stick/attach to another object (an egg)
http://wcedu.pima.edu/~jekloff/Project5.swf is my swf file. If you look at it, I basically want it to perform the same thing as the embedded movie I put in the swf. I assume there has to be some collision detection, but I dont know where to start. All I have is a draggable bandaid.
Any help appreciated.
Drag And Attach To Object
I am trying to create some scripting to make an object (bandage) to be draggable, then be able to pickup/stick/attach to another object (an egg)
here is my swf file. If you look at it, I basically want it to perform the same thing as the embedded movie I put in the swf. I assume there has to be some collision detection, but I dont know where to start. All I have is a draggable bandaid.
Any help appreciated.
Attach Video Object Using AS2.0
Last edited by Mike : 2005-03-07 at 06:20.
Is it possible to attach a video object to the stage using actionscript? I have searched high and low for an answer with no luck.
I'm aware I can add a video object to an empty movieclip in the IDE and attach that to the stage in AS, but how can I create and add a video object to a mc using just AS?
Attach Sound Object Does Not Work
i'm using the following script:
myMusic = new Sound();
myMusic.attachSound("Loop");
myMusic.start( 0, 9999 );
this works perfectly fine, the music starts playing as it should.. the problem is that this music is part of a child movie (loaded into parent movie).. when played from the parent movie, no sound plays.
any idea on how to get a a sound object to play in a child movie?
Attach Mediacontroller To Video Object
Hi,
I'm currently loading various different FLVs into the same video object using the following code:
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
my_video.attachVideo(stream_ns);
stream_ns.play("http://172.16.100.84/~davidgrant/DM/FLV/testflv.flv");
this.createTextField("loaded_txt", this.getNextHighestDepth(), 10, 10, 160, 22);
var loaded_interval:Number = setInterval(checkBytesLoaded, 500, stream_ns);
function checkBytesLoaded(my_ns:NetStream) {
var pctLoaded:Number = Math.round(my_ns.bytesLoaded / my_ns.bytesTotal * 100);
loaded_txt.text = Math.round(my_ns.bytesLoaded / 1000) + " of " + Math.round(my_ns.bytesTotal / 1000) + " KB loaded (" + pctLoaded + "%)";
progressBar_mc.bar_mc._xscale = pctLoaded;
if (pctLoaded >= 100) {
clearInterval(loaded_interval);
}
}
To change the FLV playing back through the video object, i have attached the following to different buttons:
on (release) {
stream_ns.play("http://172.16.100.84/~davidgrant/DM/FLV/test2.flv");
}
This is working well, although I would like to add a mediacontroller or alternatively, some FLV playback UI.
How do I go about attaching the controller to the video object, so that the seek, play/pause etc affects the netstream?
All advice/help is uch appreciated,
Thanks,
DigiPencil
Attach A MC To An Object Assigned To Class By Name
I have created an Actionscript 2.0 class and using the convention:
ActionScript Code:
var someVar=new menuItem(blah blah blah);
I have great success, but when I try:
ActionScript Code:
var someVar:menuItem = new menuItem(blah blah blah);
and then look at my MovieExplorer tab, I have multiple sets of recursive elements. Why?
Also, when I drop a MovieClip from the library that has been assigned to the custom AS2.0 class that I have defined, is there any way for the class to find out the objects name if it was added manually to the timeline?
I have created these custom icons that have linkageID's related to the name of their parent clip. (i.e. biography.lbl) is a LinkageID for the biography icon. It works great when I use AS2.0 in the MovieClip to attach the new menuItem's MovieClip to the stage, but when I add it manually, I can't figure out how to make the class constructor or any method to look at the object's name and then attach a clip to itself based on its name?
Let me know if I have you completley lost. I can try to explain it another way, maybe. Thanks in advance for all of your help.
Rowdy
How To Determine Object On Stage To Attach Listener?
Easy question from a newbiew - In CS3 I've added symbols to the stage that appear / disappear in various frames. Example, MovieClip instance named 'btn_mc' appears in frame 5. Frame 5 is also labeled 'intro'. The Movie is set to stop() at frame 1 upon loading and I then use naviagtion buttons to jump to various frames.
I'm using an external AS3 file which loads OK. But when it runs in can't add a listener to 'btn_mc' because the button isn't in scope (I think?) because btn_mc isn't present until a later frame.
When I navigate to frame 5, I 'think' I need to detect that the playhead has entered frame 5? or check for the existance of the MC ?... if they are then in scope, they'll be available via script manipulation (addListener, etc..)
What is the best way to accomplish this?
Thanks in advance, Dave
Dangling Object References That Attach To Other Instances
Try this code in a blank fla.
It creates a movieclip, shows that its there, removes it, shows that the references no longer point to anything, and then creates a new movie clip and shows that the old dangling reference now points to the new movie clip.
I guess the simple thing to say about this is that references follow the string path (ie. _root.obj) and it shouldn't be too suprising.
However, the weird thing is if you change the second createEmptyMovieClip to a regular object (ie. {} ), then the dangling reference does NOT attach to the new object, even though they have the same name.
(I ran into this when I had an array of refs to mc's that I would call back into. I wasn't removing a mc's ref when it closed, and a newer mc would start picking up the older mc's callbacks if the new mc got created with the same mc name)
PHP Code:
var mc = this.createEmptyMovieClip("sub", 100);
mc.crap = "crap1";
trace("new this.sub: " + this.sub + ", " + this.sub.crap);
trace("new mc: " + mc + ", " + mc.crap);
this.sub.removeMovieClip();
trace("after remove: " + this.sub + ", " + this.sub.crap);
trace("after remove: " + mc + ", " + mc.crap);
this.createEmptyMovieClip("sub", 101);
//this.sub = { };
this.sub.crap = "crap2";
trace("after new2 this.sub: " + this.sub + ", " + this.sub.crap);
trace("after new2 mc: " + mc + ", " + mc.crap); // this is the dangling reference
Flash5-sound Object-attach-tutorial Problem
Hi,
I created a simple movie for a friend, just a button that pauses and starts an mp3
it needs to work as flash 5
I used this tutorial
http://www.flashkit.com/tutorials/Au...-749/index.php
problem is using this method the entire sound loads before playing, not an option in this case.
how can I make a true pause/play button for flash 5 where the audio streams immediately
thanks mark
How Do You Attach And Play A Movie Clip To A Movie Object?
I have a movie clip in my library, and i want to use action script to play the clip on my scene1 stage. I know i can simply drag the clip on the stage, but solving this will make most of my other problems dissappear.
I tried in the first frame of my scene:
---------------------------------------
mymovie = new MovieClip();
mymovie.attchMovie(clip,clip,20);
mymovie.play();
---------------------------------------
but it did not work...help! :-)
any suggestions?
zavyzavy
[shared Object] [listener] Attach Listener To SO?
Hi everyone,
I'm trying to build a simple sound control panel for voice-overs in an e-learning project.
I want to use one button to control whether or not users want sound played throughout the lesson.
Right now I'm using that button to write an SO that each audio file reads before playing anything. My problem now is if a user wanted to hear the audio after he or she has already entered the page. If a user clicks the audio-on button, it's simply changing the SO, not to be read until the next page and swf loads.
My initial thought was I could attach a listener to the SO, allowing Flash to interpret a change from OFF to ON and then start up the necessary sound files.
Would this work? I've searched and haven't found documentation for attaching listeners to SOs.
THANKS
Sound Object Attach Sound Or Load
Hi
I am wanting two sounds in my FLA one for movie clip buttons and one for background music.
In the past I have created a sound object and just loaded the file from a location on the server, but I've just seen an aletrnative method thats works very much in the same way but you import the sound files into the library and then export for action script and then attach them to the sound object.
Which is the best method to use? If I bring them into the library do they contribute the FLA size? and if they do is this worse than just loading them?
What are the pros and cons of each method? and which is best to use?
Thanks
Ricky55
Detect A-Attach B-Release B-Attach To C ?
Ok here's something that sounds simple.
I have mc A moving slowly across the screen.
I would like to detect it's position x and y, and then at a certain coordinate(let's say x= 200 and y=300) attach mc B(which is just floating around) to attach itself to and follow mc A movement.
And then at some point attach mc B to attach itself to another mc(C).
Is it also possible to attach mc B to a certain pixel (xy) on mc A (or C).
Any ideas
Cheers
Trinitee
Attach, Remove And Re-attach MC's
I've been trying to make three movieclips animate accross the stage. They fade in, move accross and fade out.
I've got it currently set up so that they are attached at runtime - fade in / animate / fade out and are removed. The problem i'm having is getting them to re-attach properly. I can't seem to get the re-attachment loop working correctly.... here's the code as far as i have it:
ActionScript Code:
_global.k = 0;
//max amount ofo clouds allowed on the stage
var cloudsV = 3;
//create an empty clip to house all the clouds
this.createEmptyMovieClip("CLOUDcontainer", this.getNextHighestDepth());
//add the clouds
addCLOUDS()
function addCLOUDS(){
do {
//attaches the clouds from the library
//possitions them [randomly on the y - within a range]
//and set the speed randomly
CLOUDcontainer.attachMovie("cloud", "cloud"+k, k+20)
CLOUDcontainer["cloud"+k]._x = 900//randRange(50, 900)
CLOUDcontainer["cloud"+k]._y = randRange(182, 400)
CLOUDcontainer["cloud"+k].movementV = Math.random(5)+1
k++;
} while (k != cloudsV);
}
_global.fadeOUT = function(me) {
if(me._alpha>5){
//simple fade out func
me._alpha = me._alpha + ((1 - me._alpha)/10);
}else {
//removes the cloud after its been faded out
removeMovieClip(me);
//deducts one from the amount of clouds on the stage
--k
//calls the func to re-attch the clouds
addCLOUDS()
}
}
//random number within a range generator//
function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
return randomNum;
}
//
this is on the cloud MC frame 1
ActionScript Code:
this._alpha = 0;
this.onEnterFrame = function(){
if(this._alpha<90){
this._alpha = this._alpha + ((this._alpha+2)/3);
}
if(this._x>20){
this._x = this._x - (this.movementV);
}
if(this._x<150){
this.gotoAndStop("fadeOUT");
}
}
stop();
this is on the cloud MC frame "fadeOUT"
ActionScript Code:
this.onEnterFrame = function (){
fadeOUT (this)
trace(" this = "+this)
}
I think its a fairly simple problem - but if anyone can help please let me know, it would be a big help [even if you can suggest a better way of doing this ]
Attach Clips From Xml, Reload Xml Attach Clips Again
i'm trying to figure out how to reset or refresh clips that are dynamically attached to another clip based on records returned through xml.
basically if the user chooses a different filter for the database query I need to be able to refresh a scrolling list made up of clips which will be different based on the filter.
this is what I have for a function. I try to use "attachEmptyMovieClip" but to no avail. any help would be great!
Code:
getAll=function(){
members = getMembers.firstChild.childNodes;
for (var i=0; i<members.length; i++) {
holder.createEmptyMovieClip("new_mc", 10);
item = holder.new_mc.attachMovie("listClip", "listClip" + i, i);
item._y = 23*i;
item.index = i;
trace(item.index);
item.memberName = members[i].attributes.last+", "+members[i].attributes.first;
item.first= members[i].attributes.first;
item.last= members[i].attributes.last;
item.listButton.tabEnabled=false;
item.listButton.onRelease=function(){
_root.triggeredClick="detail";
_root.selectedFirst= members[this._parent.index].attributes.first;
_root.selectedLast= members[this._parent.index].attributes.last;
_root.getDetails();
_root.firstLoad=false;
}
}
}
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;
}
}
}
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;
}
}
}
Position Object By Center Of Other Object And Stage Left...?
lol! :lol:
what i mean is i have an object (mc = main_logo) that centers itself upon load:
main_logo._x = Stage.width / 2;
main_logo._y = Stage.height / 2;
and i want another object (mc = helmet) to always load up 2/3rds to the left (x axis) of main_logo's center (counting left to right, 2/3rds between main_logos center and stage left border) and 200 pixels above (y axis) main_logo's center.
i know i keep asking these things and i'm not trying to have you all do every little thing for me, i am trying to learn this! it's just that my brain operates differently and i have to assimalate information by what i'm trying to accomplish...
thanks!
How Can I Attach A Mc To Another Mc?
hey there - i have stupid problem with actionsscript:
actually i have a site where lots of mcs are to attach,
therefore i wrote a mc attachscript like this:
function attach_mc(mc,mctoattach,deepness) {
_root[mctoattach].attachMovie(mc,mc,deepness);
}
so the problem is, it just doesnt work
sometimes i attach an mc:
attach_mc("mc1","",1);
but want attach to it another mc DYNAMICALLY:
atach_mc("mc2","mc1",1);
you get the point?
how should a dynamic _root.attachMovie statement look like
so it works? any ideas or comments?
Attach A PDF?
I have a new web-site that i made completely in flash mx and i have a page for my resume.. i want to put the pdf icon of my resume on my page so that someone can click on it and it will download for them and open up in acrobat reader on their desktop.. How do i make it so that i can place my pdf file on my flash page? Please help me!
Attach A PDF?
I created a site in flash mx and i want to have a page that people can go into and click on a pdf icon and directly download my pdf file to their computer. I don't know how to get it so on my page all you see is the pdf icon.. how do i get the pdf icon onto my page for someone to download.. please help me!
Attach MC
Hey all,
I wanna ask, if it's possible to make that with the action attachmovie all the movie clips don't show up all at once, but each by each from up to down. Thanks for any idea.
Can't Attach
please help!
I can't even seem to attach this file in order to get help!!
I've tried attaching the following types of files (with the designated extensions and their file sizes) and none of them seem to work. I'm not sure how else to save and attach a file in order to get help from the bulletin board... I've tried:
Flash document .fla 20,647 kb
Flash movie .swf 938 kb
Compressed (zipped) folder .zip 939 kb
Is a swi the same thing as a swf? How do I get flash to save in that format? I don't see how attaching a .gif, .jpeg, or .bmp would help see a movie I'm making in flash. Does saving it in those formats work?
Please advise!!
THANK YOU!
Attach MC
Does anyone know how to attach a MC in AS3?
Thanks!
Attach This
Oh man!! This is seemingly basic stuff, but I just can't get it to work. I have a symbol called "Blue Square". which is a movie clip. I have an instance called "Blue". I want to create a second instance at a different x,y location on the stage. So, I try the code below, but nothing appears where Blue2 should be. What am I doing wrong?
G
myPreloadery("x4.jpg",600,20);
function myPreloadery(myMovie,xpos,ypos){
//delete this.Blue2
//this.createEmptyMovieClip("myHolder", 200)
//Blue2.loadMovie(myMovie);
_root.attachMovie("Blue Square","Blue2",200);
Blue2._x=xpos;
Blue2._y=ypos;
Blue2.loadMovie(myMovie);
_root.onEnterFrame = function() {
var myLoadedBytes = Blue2.getBytesLoaded();
var myTotalBytes = Blue2.getBytesTotal()
var myPercent = Math.floor((myLoadedBytes/myTotalBytes)*100);
if (myPercent == 100) {
delete _root.onEnterFrame
trace("Image 100% loaded!!")
trace(Blue2._height)
}
}
};
How To Attach Pdf?
Hi all,
Just wondering if anyone knows how to create a button action that will open a pdf file in a separate window?
Thanks!
How Do I Attach MCs Only Once?
I want to load animated movie clips with a toggle key (a blinking light that indicates something is turned on). Instead, it loads the first frame of the animated clip and when the toggle is shut off, it removes it. I've also tried the gotoAndplay method, and both produce the same "on/off" problem, so I figured I would have more luck with the attach MC.
is there a way to tell the program to detect for that attached movie clip, and if it exists, do not load another one/ or prevent that one from playing?
Attach 2 MCs
How do I attach 2 MCs to each other?
I don't think I want aatachMovieClip because that seems to:
add an instance of the symbol programmatically. The attachMovie() method adds a new instance of the specified symbol as a nested movie clip of the object from which the method is called.
I want to say if MC_A bumps into MC_B, then MC_A should attach itself to MC_B and follow it wherever it goes.
For my fishing game, I've tried just saying when there is a hitTest the second one's _y and _x equal the first one's, but I have some boolean vars that cause probs. The bools say if there is a hitTest, no other MC should have a hitTest.
Is there some special function for this?
Attach MC
Im having some problem attaching a movieclip on stage.
Im having a MovieClip that is laying on stage, and in this movieClip there is 3 other movieClip.
And each movieClip containing a button.
My problem is attaching a movieClip from library on stage when pressing a button.
i do have a movieClip as a container on stage, but nothing happen.
I guess it have something to do with my buttons being inside of a movieClip that is inside of a n other clip?
XML And Attach
Hey all Scripters,
this is the first of some questions i will have to post in the future, due to my lacking programming knowledge.
okay, here we go:
I have a XML picture loader which got the following code
ActionScript Code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
some of you might remember the code from the kirupa tutorial.
this script loads a XML file which is formatted this way:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image>test.jpg</image>
<caption>testimage</caption>
</pic>
Now i want to load all pics mentioned in the XML file to be displayed in a stack (a vertical row) and in a frame from the library (via the attachmovie command)
what would I need to do? I'm totally stuck on this.
Thanks a lot in advance guys!
Attach Mc
Could anyone tell me how I can attach a movieclip instead of loading a.jpg from the code below. Any help would be appreciated.
ActionScript Code:
btn39_btn.onRelease = function() {
loadThenGrow("images/portraits/port_20.jpg");
};
// LoadTheGrow function takes a target image name.
// Targets are hard-coded for the moment because I'm lazy
function loadThenGrow(img) {
bg_square_mc._parent.holder_mc.removeMovieClip();
bg_square_mc._parent.createEmptyMovieClip("holder_mc", 1);
bg_square_mc._parent.holder_mc._visible = false;
bg_square_mc._parent.holder_mc.onData = function() {
if (this.getBytesLoaded() == this.getBytesTotal()) {
this._visible = false;
// Image fully loaded, grab dimensions and resize
// background clip
w = this._width;
h = this._height;
bg_square_mc.growTo(w+1, h+1, 10, _root.showHolder);
}
};
bg_square_mc._parent.holder_mc.loadMovie(img);
}
function showHolder() {
w = bg_square_mc._parent.holder_mc._width;
h = bg_square_mc._parent.holder_mc._height;
bg_square_mc._parent.holder_mc._x = bg_square_mc._x-w/2;
bg_square_mc._parent.holder_mc._y = bg_square_mc._y-h/2;
bg_square_mc._parent.holder_mc._visible = true;
}
How O Attach A Movie?
I have a problem with attaching the movie. Line looks something like that: attachMovie( "pausa", "p", 100 )
Pausa is the linkage in Library (that should be OK).
When I hit CHECK SYNTAX I GET THIS:
******* You must export your movie as Flash 5 to use this action.
attachMovie( "pausa", "p", 100 );***********
HELP!!
Attach Movie
Hi
Does anyone know why we choose to use Attach Movie instead of duplicate Movie ? what is the advantage?
Thanks in advance
MKit de HK
Attach Sound
Hello,
Could anyone tell me how to work with sound in flash 5
and how to make a continous background sound
Regards
Attach 2 CGIs To One SWF ? Possible ?
Hey guys, I need help, i'd like to know if there is a possibility to attach 2 CGIs to 1 SWF ?
Well, for one CGI, i use this syntax :
<param name=movie value="http://www.mypage.com/myflash.swf?cgilocation=http://www.mypage.com/mycgi.cgi">
I hope someone could help me ! Many thanks !
See you !
Attach Movie
Hi there,
Ok, I'm new to the multiple swf file idea. I thought it was pretty nice to have all the data in yust one file.......but, offcourse, it got to big.
So I Kicked all the background images in a BGlib.swf and all the pics in a PIClib.swf. Got the TUT about attachMovie and so it worked in my preview mode..........but not online??
Q: do you need loadmovie to use attach?
Q: is it possible to make a big library.swf but load just the MC you need?
oh, the code I used:
placeHolder.loadMovie("library.swf");
placeHolder.attachMovie("bg_ssl", "ssl", 0);
please help......
thanks
|