Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Clip Event Moese Move Won't Work



i have put a movieclip in scene_1, this movieclip i gave the instance name "1".
i have put an action on the movieclip:
___________________________
onClipEvent (mouseMove) {
x = x+15;
}
___________________________

and on the first frame of the scene_1 i have put the action:
_________________________________
setProperty ("1", _rotation, x);
_________________________________

Why is there nothing happening when i move my mouse?



FlashKit > Flash Help > Flash ActionScript
Posted on: 03-24-2002, 12:54 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Why Won't This Movie Clip Code To Move Work?
I have a movie clip nested within a movieclip called "Upper". I am trying to move UPPER across the screen. OnClipEvent(enterFrame) works fine to move the clip so long as it is an instance of upper on the stage. (in other words a nested movie clip containing Upper and the movie below it.)
I want to be able to make the movie clip UPPER move across the screen, but have the action script within the UPPER movie clip and not the instanced Movie Clip. This is my code:

onClipEvent(load) {
Move = this._x;
if(Move < 810) {
_x = _x +5;
}
}
When the movie plays, UPPER remains stationary however the nested movie inside of UPPER plays fine. Why isn't the movie clip traversing the screen?

Getting StopDrag To Work On A Clip Event
I'm trying to get a MC to drag with my cursor whenever the cursor moves into a designated area. The trouble is, the script for the "designated area" isn't working. I can get everything to drag correctly, but I can't get the drag to happen ONLY when the cursor is in the right area. Here's my code (it's so ridiculously long because I've been rewriting it every way to Sunday in the hopes that it's an Actionscript bug with the if statements...):


Quote:




onClipEvent (enterFrame) {
if (_xmouse < 731) {
if (_xmouse > 14) {
if (_ymouse < 146) {
if (_ymouse > 22) {
_level0.gradient.startDrag(true, 108, 87, 623, 87);
}
}
}
}
}

onClipEvent (enterFrame) {
if (_xmouse > 731) {
if (_xmouse < 14) {
if (_ymouse > 146) {
if (_ymouse < 22) {
_level0.gradient.stopDrag();
}
}
}
}
}






Any ideas on how to constrain the dragging to the area listed?

Why Does My On Clip Event Pop Up Windown Not Work On Safari?
I'm using the following code...and it automatically launches a pop up with firefox and IE, but on safari, it don't work. What is going on? Any work around for this?



onClipEvent (load) {getURL ("javascript:NewWindow=window.open('southafrican.h tml','newWin','width='+screen.availWidth+',height= '+screen.availHeight+',left=0,top=0,toolbar=No,loc ation=No,scrollbars=No,status=No,resizable=No,full screen=No'); NewWindow.focus(); void(0);");


}
on (release) {
getURL ("javascript:NewWindow=window.open('southafrican.h tml','newWin','width='+screen.availWidth+',height= '+screen.availHeight+',left=0,top=0,toolbar=No,loc ation=No,scrollbars=No,status=No,resizable=No,full screen=No'); NewWindow.focus(); void(0);");
}

Event Listeners- Move MC
ok..sorry for the post, i havent looked at flash for a while and what id learnt is forgotten and what i remember is proberly out dated!

I want a full screen flash movie with a mc position in a specific place. Upon a button action, how can a move 'gracefully' this mc, say 200 pixels or a % to the left?

What i used to do for the original setup and position was


ActionScript Code:
Stage.scaleMode = "noScale";
Stage.align = "TL";
Stage.addListener(this);

this.onResize = function ()
{
    movie._x=Stage.width*(50/100);
    movie._y=Stage.height*(98/100);
    menu._x=Stage.width*(50/100);
    menu._y=Stage.height*(50/100);
};

this.onResize();

Many thanks in advance

Bugs Of Component.move Event?
Code:
case 1:

var listener:Object = new Object();
listener.move = function(eventObject:Object):Void {
trace("move");
}
propertiesAddText.addEventListener("move", listener);


case 2:
var listener:Object = new Object();
listener.move = function(eventObject:Object):Void {
trace("move");
}
propertiesAddText.addEventListener("move", listener.move);


case 3:
function doMove(eventObject:Object):Void {
trace("move");
}
propertiesAddText.addEventListener("move", doMove);
Both case 2 and 3 are worked so "move" is printed out.
Why case 1 cannot work?

As for the use of case 1, it is like the use of click or complete for window component.....

Can Event Handler Move Z-order To Top Level
i've got buttons sitting in clips which all sit on different levels. on rollover, i want the button to jump over all the other clip's levels surrounding it. anyone?

sbb

[CS3,AS2,FuseKit] Help With Switching Mouse Move Event On/off
Hi everyone, my first post here but here goes...

I have a mouse trailer that lets the user smear paint splats over the stage area. The trailer works fine stand alone, but when I attach a listener to give the user the option to turn the trailer on/off via a pair of buttons, the trailer turns on/off but now fails to follow the mouse cursor! DOH!

Here's the trailer code...
(I've attached the CS3 file just in case)

Code:
i = 0;
onMouseMove = function() {
var cur_x = _xmouse;
var cur_y = _ymouse;
var limit = 4;
var min = .5;
var max = 40;
var alfa = 160;
var delta_x = old_x-cur_x;
var delta_y = old_y-cur_y;
var dist = Math.sqrt(delta_x*delta_x+delta_y*delta_y);
old_x = cur_x;
old_y = cur_y;
if (dist>limit) {
i++;
attachMovie("splatMC","splatMC"+i,-510+i);
with (this["splatMC"+i]) {
var ran = Math.random()*max+min;
var ran2 = Math.random()*alfa-alfa/2;
_rotation = ran2;
_xscale = _yscale=ran;
_x = _parent._xmouse;
_y = _parent._ymouse;
}
}
};
stop();
and here's the trailer code with the listener attached...

Code:
i = 0;
var mouseListener:Object = new Object();
mouseListener.onMouseMove = function() {
var cur_x = _xmouse;
var cur_y = _ymouse;
var limit = 4;
var min = .5;
var max = 40;
var alfa = 160;
var delta_x = old_x-cur_x;
var delta_y = old_y-cur_y;
var dist = Math.sqrt(delta_x*delta_x+delta_y*delta_y);
old_x = cur_x;
old_y = cur_y;
if (dist>limit) {
i++;
attachMovie("splatMC","splatMC"+i,-510+i);
with (this["splatMC"+i]) {
var ran = Math.random()*max+min;
var ran2 = Math.random()*alfa-alfa/2;
_rotation = ran2;
_xscale = _yscale=ran;
_x = _parent._xmouse;
_y = _parent._ymouse;
}
}
updateAfterEvent();
};
stop();
Sorry if it's painfully obvious what the problem is, but I'm a designer rather than a hardcore code monkee!

Thanx in advance

Menu Clip With Labels _up, _over And _down Containing Another Clip That We Can Click To Move To Another Frame
Ok, i have that code in first frame of my main scene:

stop();
mon_clip_mc.onRelease = function() {
mon_clip_mc.smenu1_mc.onRelease = function() {
_root.gotoAndStop(20);
};
mon_clip_mc.smenu2_mc.onRelease = function() {
_root.gotoAndStop(30);
};
};

I have "mon_clip_mc" on the main scene. Then, in that "mon_clip_mc" first frame code i only have a :

stop();

And in that "mon_clip_mc" i have the labels _up, _over and _down. At the _over label starts the movie clips "smenu1_mc" and "smenu2_mc". Those are the one i want to click on to go to frame (20) and (30).

As I did it, it doesn't work. Am I doing it the good way, is my code in the good place, should i use "hitareas", if yes, how ?

Thanks, i'm kind of lost...

Move Movie Clip On Button Clip
This is a script that causes a movie clip to move down to a new location when a button nested inside the movie clip is released. can anyone tell me how to write the code so that when a different button is pressed the movie clip will move back to its original position. I am trying to learn actionscript 2.0 by taking the posted files apart and so on, I have a ton o books none of which are too helpful so I could really use some help. What the heck is "ty". I decided to join the forum because books were not cutting it! LOL

here is the code thanks.

ActionScript Code:
// this is the main button to start the slide show
collButtHolder.slide1.onRelease = function() {
    //move the to menu down to reveal the slide show components
    slide(collButtHolder,324);
    // call the function to set up slide show or reset it you had other buttons
    // this is where you set your path to the photos and how many photos are in that folder.
    resetSlideShow("images/slide1/", 15);
    collectionMenu.bName.text = "slide1";
};

function slide(mc, ty) {
    mc.onEnterFrame = function() {
        mc._y += (ty-mc._y)/5;
        if (Math.abs(ty-mc._y)<0.4) {
            this._y = ty;
            delete mc.onEnterFrame;
        }
    };
}

How To Disable The Clip Event Of A Movie Clip
I have clip events within a movie clip, what i need to do now is to only execute the clip events on a specific frame, any suggestions as to how to disable the clip events on a particular frame and able it on another frame?

Detecting A Mouse Event On A Clip Within A Clip
Hello,

I am trying to detect a mouse click on a clip within a clip, but it's not working. I have read that it's not possible to detect a child_mc.onMouseOver is 'child_mc' is within 'parent.mc'.


But there must be a ways around it, right?


Thank you.

OnRelease Event Does Nothing For Clip Inside Clip
I have a "menu" movie clip. Inside that is an instance of another "button" movie clip named "myButton". The menu clip is exported for actionscript. In my main timeline I have an empty clip with the instance name of "empty". The code is:

_root.empty.attachMovie("menu", "myMenu", 1);
//menu clip is attached
_root.empty.myMenu.myButton.onRelease = function () {
trace("this never shows");
}

why does the onRelease event not do anything? If i put this code directly on the myButton instance inside the menu clip I don't see the trace either. However, the following code DOES work:

_root.empty.attachMovie("menu", "myMenu", 1);
//menu clip is attached
_root.empty.myMenu.onRelease = function () {
trace("this shows");
}

but i need the code to execute when the button inside the menu is clicked not the whole menu itself. Any help is appreciated!

Move Art Work Over In .fla Doc. W/o Messing Up Tweens
I have a bunch of layers w/ tweens in them. I want to reposition all of the layers in the layout. When I select all my layers and move them over, my tweens get messed up!

Is there an easy way to select all layers to reposition them on the layout???

Please help! Thanks

When I Move Code To Next Frame, It Does Not Work
I have a long stretch of AS in the 3rd frame of my main movie. I would like to start some more code in frame 4 (for preview purposes, I can use a gotoAndPlay action for that frame so I don't have to watch entire movie each time)

The code works fine when placed at the end of all code in the third frame, but when I move it to the fourth it does not work at all. (right now it is just attaching a testMC) I have been trying adding stops and anything else I can think of which may be the cause for this but I cannot figure it out.

I feel as though it is something really simple I must be overlooking or possibly just don't know. Earlier in the movie, I have content in frame 2 and it moves to the content in frame 3 just fine???

Here is the actual movie so that it can be opened to look at the code, though if it is played there are many loaded movies which will cause a lot of errors.

I would really appreciate if someone could see what I am or am not doing!

MyAcc.childA.move(); Doesn't Work
Context: Accordion component with children.

Objective: Position (move) children.

Problem: myAcc.childA.move(); doesn't work. Accordion children do not have the move() method. How can I move the accordion's children within the master accordion? I've achieved this positioning while working on the scene, so I figure it's possible through AS...right?

TIA,
Michel

Can't Move Stage Work Area With Hand Tool
I feel like a goof posting this simple question, but I can't understand this...

When you create a new doc in flash, it creates a work area that you can move around with the hand tool (or by pressing the spacebar).

When I resize the work area (stage), I cannot move it any longer. It is always locked to the upper left corner.

Is there a way to unlock this?

Thanks.

Still Trying To Get This Timed Event To Work
I am trying to get my movie to load 1.swf wait 5 seconds and then load 2.swf I am goning to post my fla can some one please look at it and help me?

I am using FlashMX

Thanx in advance

Sandi

How Does An Event Listener Work?
I'm having trouble finding a tutorial or article that can eloquently explain what exactly an event listener does and why it's useful. Can anyone elaborate for me? So far this is what I understand about them: They're good for making sure an event has completely occurred before a script moves on to the next procedure.
So, for example, I'm creating a flash game that sends your name and your score to a mysql database at the end of the game, then displays the top ten highest scores in the database using XML nodes. A friend of mine was saying that if I don't use an event listener for the loadvars sendAndLoad event, that the script might move too fast before it has time to include a player's score in the high score list (if it's top ten) in any given game. So I think he's right because sometimes I'll get a high score and it won't update in the list before I used this addEventListener. Or so I think. How can I really tell if it's really working? Am I using the addEventListener correctly here:

Code:
// Here's where I use the LoadVars object to send the player's name and score to the database
var mySender = new LoadVars();
var myReceiver=new LoadVars();
myReceiver.onLoad = function(success) {
if(success){
trace("added");
}
}
mySender.playername = _root.playername;
mySender.score = score;
mySender.sendAndLoad("addscores.php",myReceiver,"POST");
mySender.addEventListener("sendAndLoad", myReceiver.onLoad); // Am I using the addEventListener correctly?


// Here's where I grab the XML nodes from the php script....
scores_xml = new XML();
scores_xml.onLoad = getScores;
scores_xml.load("addscores.php");
scores_xml.ignoreWhite = true;

Help, Move A Clip Using X,y
hi, this is the scene:

i have a 400x300 flash movie, inside i have a 1200 x 900 clip, i need to move this clip with different buttons, the 1200 x 900 clip contains the backgroud images for each section like ( about us, contacts, services, etc etc) my idea is this: If the user clic on about us button, the 1200 x 900 clip moves to the center of the main movie, do you know what i mean ?? i guess

if not, i just know how to move a clip with x and y propierities from a button.

PLEASE HELPPPP !!!

thanks

Why Don't Event Handlers Inside MCs Work?
Hello,

Here's what I want to do:

I want to put this action in the first frame of an MC and have it go over and over. Apparently you can't use onClipEvents inside an MC, they can only be attached to an MC instance. Here's my code:

onClipEvent (something) {
if (_parent.hitTest(_root._xmouse,_root._ymouse,0)) {
//It is over your movie clip
_parent._rotation += 5;
}
else
{
//It's not over your movie clip
while(_parent._rotation/4 != 0)
{
_parent._rotation += 5;
}
updateAfterEvent();
}
}

If I replace _parent with "this" and place on each instance of the MC in the movie, it works, but I want to create these instances dynamically and I don't know how to attach an action to an MC after you create it. ( I guess I can duplicate a clip that is off stage, right?)

The root of the problem is that I keep trying to do something and it doesn't work. I tried this as well in a one frame MC:

if (_parent.hitTest(_root._xmouse,_root._ymouse,0)) {
//It is over your movie clip
_parent._rotation += 5;
}
else
{
//It's not over your movie clip
while(_parent._rotation/4 != 0)
{
_parent._rotation += 5;
}
updateAfterEvent();
}

gotoAndPlay(1);

Can you make a suggestion?

TIA,
Matt

Event Sound Doesn't Work
hi,

I'm trying to load and play an eventsound but it doesn't work . Here is some code:

var newsound = new Sound();
newsound.onLoad = function(success:Boolean) {
trace("complete");
this.play(0,999);
}
newsound.loadSound("track3.mp3",false);

Why is this not working while it does work when I set it as a streaming sound?
When the track is loaded, it traced complete but it doesn't start playing. Any idea?

Cannot Make Event.ENTER_FRAME Work, I Am New To AS3
Hey. I am struggling to make this simple function work. It was an AS1/2 onEnterFrame function and i thought making it work in AS3 should be easy. Here is my code. Great if anyone can point to the basics i have to do to make this work.




ActionScript Code:
[font="Courier New"]
import flash.display.*;
import flash.events.*;
function Main() {
stage.addEventListener(Event.ENTER_FRAME, sprelling());
}
Main();
function sprelling(){
    trace("Potte");
    //lux = this._xmouse;
    //luy = this._ymouse;
    var lux = stage.DisplayObject.mouseX;
    var luy = stage.DisplayObject.mouseY;
    //trace (luy);
    stage.sprell.rotation = (((((lux)-(350))*(-0.005)))+(((luy)-(50))*(0.08)));
    stage.sprell.laar.rotation = ((((lux)-(350))*(-0.01))+(((luy)-(50))*(-0.15)));
    stage.sprell.laar.kropp.rotation = ((((lux)-(350))*(0.06))+(((luy)-(350))*(0.07)));
    stage.sprell.laar.kropp.arm.rotation = (((lux)-(350))*(0.04));
    stage.sprell.laar.kropp.bakarm.rotation = (((lux)-(350))*(0.04));
    stage.sprell.laar.baklaar.rotation = (((lux)-(350))*(-0.03));
    stage.sprell.laar.baklaar.bakfot.rotation = (((lux)-(300))*(0.06));
}

Return Value Of Function After EVENT Does Not Work
Hi again,

I made a game and put it into one function. And i want the score given back to my main program: (here only as a trace)


ActionScript Code:
trace(MyGame());

and this is my game (not original... is too long to insert here)


ActionScript Code:
function MyGame ():int {

  ...

  var example:int;

  var myTimer:Timer = new Timer(10, 1000);
  myTimer.addEventListener(TimerEvent.TIMER, fu);
  myTimer.start();

  fu(){
    increases example++ a few times;

    trace("test");
  }

return example;
}

now let me explain: when the "fu" function starts, everthing is fine, but when the Timer ends, the "fu" functions will not be left so that the "MyGame" functions does not return the "example" integer...

When i insert a trace with a text, ("test") the trace is printed, but the function will not be left... so i never get my example-int back out of the MyGame function....

why???

Why My Mouse Event Doesn't Work ?
THIS WORKS:




ActionScript Code:
stage.addEventListener(MouseEvent.CLICK,onClickHome);

function onClickHome(event:MouseEvent):void {
     navigateToURL(new URLRequest("http://www.google.com"), "_blank");
}





THIS DOESN'T WORK (of course I click over the object controls (it is a movie clip..)




ActionScript Code:
controls.addEventListener(MouseEvent.CLICK,displayControls);

function displayControls(event:MouseEvent):void {   
    navigateToURL(new URLRequest("http://www.google.com"), "_blank");

}



why ?

My Event Proc Doesn't Work. Help?
Hi:

I'm using this code in an mc
on(press)
{
this.attachMovie("Section7Lgt", "Section_mc", 2);
this.Section_mc.onPress = Section_mc.removeMovieClip;
_root.gotoAndPlay(10);
}

Section_mc sits right on top of this mc. I can see it.
Notice that I *tried* to set its Press event proc.
When I click it, it just runs THIS code again.

How can I make it unload the second mc when it's clicked?

Event Handler Won't Work In Firefox
I have an external swf which launch a flv video. On the first frame of the fla I have a function to handle an event which will load next swf when the video complete playing. This is the code:
function playerCompleteHandler(evnt:Object) {
//load next swf
_root.loader_mc.loadMovie("intro_community.swf");
}
flv_welcome.addEventListener("complete", playerCompleteHandler);

It works well with IE and Safari but not Firefox. Is there any other way to handle this?

Any help will be greatly preciated.

[AS3] Keyboard Event Wont Work :(
I decided to pick up a copy of O'reilly Actionscript 3 Cookbook today, and I have been going through. One of the first examples it has for keyboard events is:


Code:
package {
import flash.display.Sprite;
import flash.events.KeyboardEvent;

public class ExampleApplication extends Sprite {
public function ExampleApplication( ) {
stage.focus = this;
addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
}

private function onKeyDown(event:KeyboardEvent):void {
trace("key down: " + event.charCode);
}
}
}
But for some reason it will not work. According to the book stage.focus = this; is all you need for keyboard events to work, am i doing something wrong?

Custom Event Class Did Not Work :(
ActionScript Code:
package com.blah.dfm{

import flash.events.Event;
import flash.xml.XMLDocument;

public class XMLLoaderEvents extends Event {

public static const LOADED:String = "loaded";

private var _xml:XMLDocument = new XMLDocument();

public function get xml():XMLDocument {
return _xml;
}

public override function clone():Event {
return new XMLLoaderEvents(type, bubbles, cancelable);
}
public function XMLLoaderEvents(type:String, bubbles:Boolean=false, cancelable:Boolean=false):void {
trace("huh?!");
super(type, bubbles, cancelable);
//_xml = xml;
}
}
}




this is custom event class, but when I dispath it gets error:


Quote:




huh?!
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.theflashblogbg.dfm::XMLLoader/:mlLoaded()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()




there is what I dispatch, this is written in class
ActionScript Code:
var mc:MovieClip = new MovieClip();
mc.stage.dispatchEvent(new XMLLoaderEvents("loaded"));








->>>>>>>>>>>>>>>>>>>>>>>


ops I do it.

RemoveChild (event.target)- Why Can't This Work?
I've been forced to ask you a question. I'm very sorry. But here goes:


The question has to do with the moveBall function at the bottom.



Code:
createBall (4);

function createBall(numberofballs:Number) {
for (var i=0; i < numberofballs; i++) {
var ball:MovieClip = new MovieClip;
ball.graphics.beginFill(0xFFFFFF, .5);
ball.graphics.drawCircle(0, 0, 15);

addChild(ball);
ball.addEventListener(Event.ENTER_FRAME, moveBall);
}
}

function moveBall (event:Event)
{
parent.removeChild(event.target);
}
All I want to do is remove from the display list the object that dispatched the event. How do I do this?
Every version I've tried gives me errors: 1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.displayisplayObject.?

Thanks!!!

Button Event Handler Won't Work?
I'm trying to create a dynamically generated (duplicateMovieClip) menu system. I load thumbnail images from a text file into each duplicated copy but as soon as I load the images all of the other properties and variables of the clip disappear.

Is there a way around this? Also I can't get the button event handler to work on the duplicated clips. Any suggestions?

messageURL = _root.login + ".txt"

setUpMenus = function() {
counter=1
while (typeof(myNavVars["photo"+counter]) == "string") {
if (counter>1) {
duplicateMovieClip(thumb1, "thumb"+counter,counter)
this["thumb"+counter]._x = this["thumb"+(counter-1)]._x + 110
}
loadMovie(myNavVars["photo"+counter]+".jpg", this["thumb"+counter])
this["thumb"+counter].slideNum = myNavVars["photo"+counter]
this["thumb"+counter].contentFile = myNavVars["photo"+counter]+".jpg"
this["thumb"+counter].onRelease = function () {
_root.imageNum = this.slideNum
loadMovie(this.contentFile, _root.imgHolder)
}
counter++
}
}

myNavVars = new loadVars()
myNavVars.onLoad = function() {
_root.menu.menu.setUpMenus()
}
myNavVars.load(messageURL)

I Can Never Get AddEventListener(Event.PROGRESS... To Work
Whenever I try to use the progress event for any type of loading, I always get this error:
Desc: 1119: Access of possibly undefined property PROGRESS through a reference with static type Class.
Source: picLoader.addEventListener(Event.PROGRESS, picProgressHandler);

What am I doing wrong?

This code is straight from Adobe's example...

http://livedocs.adobe.com/flash/9.0/Act ... oader.html

Code:


//on timeline in flash movie
import fl.containers.UILoader;
import fl.controls.Label;
import fl.controls.ProgressBar;
import fl.controls.ProgressBarMode;

var picLoader:UILoader = new UILoader();
        picLoader.scaleContent = true;
        addChild(picLoader);
        picLoader.x = 25;
        picLoader.y = 25;
        picLoader.width = 190;
        picLoader.height = 230;
picLoader.source = "mypicture.jpg";

picLoader.addEventListener(Event.PROGRESS, picProgressHandler);
picLoader.addEventListener(Event.COMPLETE, picCompleteHandler);

function picCompleteHandler(event:Event) {
    trace("Number of bytes loaded: " + picLoader.bytesLoaded);
}

function picProgressHandler(event:ProgressEvent):void {
        var myLabel:Label = new Label();
        myLabel.autoSize = TextFieldAutoSize.LEFT;
        myLabel.text = "";
        myLabel.move(10, 10);
        addChild(myLabel);
       
        var myProgressBar:ProgressBar = new ProgressBar();
        myProgressBar.mode = ProgressBarMode.MANUAL;
        myProgressBar.move(10, 30);
        addChild(myProgressBar);
       
    var uiLdr:UILoader = event.currentTarget as UILoader;
    var kbLoaded:String = Number(uiLdr.bytesLoaded / 1024).toFixed(1);
    var kbTotal:String = Number(uiLdr.bytesTotal / 1024).toFixed(1);
    myLabel.text = kbLoaded + " of " + kbTotal + " KB" + " (" + Math.round(uiLdr.percentLoaded) + "%)";
    myProgressBar.setProgress(event.bytesLoaded, event.bytesTotal);
}

Papervision: My Event Listeners Don't Work
I wanted to add some features to the PV3D Carousel I found on this forum. I got the plane to rotate with my mouse movement, but I can't make the icons recognize mouse events. If I disable the code for mouse events everything else works fine. Please help!

Code:

//load Papervision Classes
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
import org.papervision3d.objects.*;
import org.papervision3d.materials.*;
import caurina.transitions.Tweener;
import org.papervision3d.core.*;

//declares the variables for movement
var total:Number = 10;
var size:Number = 1500;
var yAngle:Number = -400;
var radius:Number = 400;
var angle:Number = 00;
var speed:Number = 6000;

//puts the blank container on the stage
var container:Sprite = new Sprite();
container.x=stage.stageWidth * 0.5;
container.y = (stage.stageHeight + yAngle)/2;
addChild(container);

//variables for 3d camera movement
var scene:Scene3D = new Scene3D(container);
var camera:Camera3D = new Camera3D();
camera.zoom = 11;


var xmlLoada:URLLoader;
var xmlData:XML;
var planeContain:Dictionary=new Dictionary();


//next, loading the thumbanils via xml
function loadXml(xmlFile:String):void
{
   xmlLoada= new URLLoader();
   xmlData = new XML;
   xmlLoada.addEventListener(Event.COMPLETE, xmlLoaded);
   xmlLoada.load(new URLRequest(xmlFile));
}

loadXml("icons.xml");

function xmlLoaded(e:Event):void
{
   xmlData = XML(xmlLoada.data);
   loadThumbs();
}

function loadThumbs():void
{
   var attributes:XMLList = xmlData.icon.attribute("images");

   for (var i:uint=0; i < total; i++)
   {
      var imageAttribute:XML = attributes[i];

      var stuffing:BitmapFileMaterial = new BitmapFileMaterial(imageAttribute);
      stuffing.oneSide = false;
      stuffing.smooth = true;
   
      var daplane:Plane = new Plane(stuffing,200,145,2,2);
      
      daplane.x = radius * Math.cos(Math.PI*2/total * i);
      daplane.y = yAngle;
      daplane.z = radius*Math.sin(Math.PI*2/total * i);
      daplane.rotationY = (-i*Math.PI*2/total) * (180/Math.PI) + 270;
      scene.addChild(daplane);
      
      var myPlaneContainer:Sprite = daplane.container;
      planeContain[myPlaneContainer]=daplane;
      trace(planeContain.valueOf());
      /* START OF PROBLEM AREA (IT RUNS IF I DISABLE THIS)
      //listen for mouse events
      myPlaneContainer.buttonMode = true;

      myPlaneContainer.addEventListener( MouseEvent.ROLL_OVER, rollOnIt );
      myPlaneContainer.addEventListener( MouseEvent.CLICK, clicka );
      myPlaneContainer.addEventListener( MouseEvent.ROLL_OUT, rollOffIt );
      function rollOnIt(evt:MouseEvent)
{
var maskked:Sprite=evt.target as Sprite;
maskked.alpha = 0.5;
//we use the container sprite to do an alpha change
}
function rollOffIt(evt:MouseEvent)
{
var maskked:Sprite=evt.target as Sprite;
maskked.alpha = 1;
//we use the container sprite to do an alpha change
}
function clicka(evt:MouseEvent)
{
//here we retrieve the plane which is clicked
var maskked:Sprite=evt.target as Sprite;
var daplane:Plane=planeContain[maskked]

Tweener.addTween(daplane,{rotationY:newY,time:1,transition:"easeoutquint"});
}
END OF PROBLEM AREA
*/
}
}

this.addEventListener(Event.ENTER_FRAME, wobble);

function wobble(e:Event)
{
Tweener.addTween(camera,{x:stage.mouseX-(stage.stageWidth),time:2,transition:"easeoutquint"});
Tweener.addTween(camera,{y:stage.mouseY-(stage.stageHeight),time:2,transition:"easeoutquint"});
angle += (mouseX-stage.stageWidth/2)/speed;
   camera.x = Math.cos(angle)*size;
   camera.z = Math.sin(angle)*size;
   //camera.rotationX = mouseX / 2;
   scene.renderCamera(camera);
}

My Button Won't Move My Clip
Hi all,

I'm trying to use a button that's in an mc to move an mc called panel1 that's on the maintimeline. I have this function on the main timeline:

function moveright(clip) {
if (clip._x <= 350) {
clip._x += 10;
}
}

The code on my button is:

on (release) {
_root.moveright(_root.panel1);
_parent.gotoAndPlay(1);
}

What happens when I click the button is that it my panel1 mc just moves 20 px to the right all at once then stops. I want it to move continually. What am I missing?

Thanks in advance.

Jazzyday

How Do I Move A Whole Movie Clip?
I was working on a movie, and I inserted a movie clip. The movie clip was cut in on the wrong place on the screen, and I wanted to reposition it, but I don´t know how to move all the frames to the exact same position on the screen!
Can somebody please help me?

I Want To Move My Movie Clip
using the kerboard arrows,(mouse if possible), and keyboard letters!
how can i do it?
can i do it using onClipEvent(keyDown)?
if ys then how?
thanks in advance
Peleg

Movie Clip Won't Move
Hi all,

I'm trying to dynamically create movieclip instances with attachMovie(). The problem is, I'm trying to change the position with the _x and _y properties and it doesn't work. The movieclip appears on the stage but the position remains 0,0. Here's my code:

attachMovie("radioButton", "radioButton1", 2);
radioButtion1._y = 10;
radioButtion1._x = 10;

Like I said, the clip won't move. I've tried to change other properties, like _width, without problems. So, if anyone knows what I'm doing wrong, I'd appreciate some help.

Thanks,

Makac

Duplicate Move Clip ( )
ok folks, bare with me- working with version 4 here. No laughing. I just came back from using the dragable window tutorial for 4 and have a question. I want to build an open button. This is the code I was instructed to use in the tutorial:


Code:
On (Release)
Duplicate Movie Clip ("/window", "/window" & x, x)
Set Variable: "x" = x + 1
End On

When I try and enter this info, Flash gives me a window saying:

Quote:




a syntax error was encountered in an action

action: duplicate move clip ("/window","/window_x",x)

parameter: depth

value: numeric

error: a numeric value was expected




What’s up? According to the code, I told it to set variable "x=x+1"

Thanks.
CRO8

-=Move Movie Clip=-
Although this should be a breeze for someone such as myself... I can't seem to get a certain aspect to work...

I need to basically move/duplicate a currently existing movieclip into another dynamically created movieclip. All attempts thus far have failed

::::::::::::::::::::::::::::::::
I tried a general duplicate movie clip method.

==
duplicateMovieClip("Close", "CloseButton", eval(WindowName+".TitleBar"));
==

This faultered as the duplication just occured on the root -_-

::::::::::::::::::::::::::::::::
I even attempted creating a null movie clip in one of my layers then swaping depth.

==
eval("_root."+WindowName + ".TitleBar").createEmptyMovieClip("closeholder ", 1);
Close.swapDepths(eval(WindowName+".TitleBar.closeh older"));
==

In this case I'm probably using [and understanding] depths incorrectly. Basically I assumed depth/target/object were interchangable as in specification of a path... or a general depth.

::::::::::::::::::::::::::::::::
Any idea's on moving my movie clip around throughout other dynamic movieclips/objects? Im thinking I MIGHT have to specify the path as a variable then eval the var to associate properly... hmm.

Thanks in ahead,

~Zeth

Move A Clip Symbol (x And Y)
Hi

how can I move the "blink" symbol, found in the library, to the same location of the thumbnail being rolled onto using AS???

ie. the "blink" symbol would cover the current thumbnail being rolled on.

I have tried eveything , but no luck...please help

i have attached the fla..notice that the thumbnails dont have an onRoll effect.
thanks

Move Movie Clip
Hi,

I want to start a movieclip ( travel) or graphic, but i guess a movieclip is better, from one place move to another. The starting point is variable (a land on the worldmap) the destination is steady (Amsterdam, The Netherlands). The worldmap is a movieclip, countries are buttons). So the user clicks a country as a starting point.

Does anybody how to do this?
Help will be nice.

Thanx
FD

Timing A Move Clip
I'm wondering if there is a way to assign a "timer" to a clip, so that after a certain amount of time elapses, it starts over.. any ideas?


thanks

MOVE One Movie Clip To Another Mc
Hello

With the click on one button, I want to MOVE a specified movie clip "ARROW" to another "mc". Then with the click on the next button I want "ARROW" to slide close to another "mc". And so on in the same form.

I have no idea about this slide/movement script.
If this is very difficult, the more easy possibility might be to tell "ARROW" go to this x/y coordinates.

Can you tell me how?

Thank you.

Tito.

How Do You Ake A Move Clip Run Away From The Mouse?
i need urgent help, i need to make a movie clip run away from the mouse but i have no idea how!!!! please can someone help?



me

Movie Clip Move
Hi all,

I have tried everywhere looking for a fix for this code. I am looking to have mulitable buttons which when pressed, will move a movie clip to a specific point 1. If the movie clip is aleady at that specific point... it will move to specific point 2.

Ok... here is an example of what I am talking about.

On the button the action is this:


on (press) {
_root.over = true;
}


Which sets off the script on a movie:


onClipEvent (enterFrame) {
if (_root.over_y = 400 {
_root.over_y = 200;
_root.over_x = 200;
ydif = (_root.target._y-_root.over_y)/10;
xdif = (_root.target._x-_root.over_x)/10;
_root.target._y -= ydif;
_root.target._x -= xdif;
_root.over02_y = 50;
_root.over02_x = 50;
ydif = (_root.target02._y-_root.over02_y)/10;
xdif = (_root.target02._x-_root.over02_x)/10;
_root.target02._y -= ydif;
_root.target02._x -= xdif;

}else{
_root.over_y = 400;
_root.over_x = 400;
ydif = (_root.target._y-_root.over_y)/10;
xdif = (_root.target._x-_root.over_x)/10;
_root.target._y -= ydif;
_root.target._x -= xdif;
_root.over02_y = 200;
_root.over02_x = 200;
ydif = (_root.target02._y-_root.over02_y)/10;
xdif = (_root.target02._x-_root.over02_x)/10;
_root.target02._y -= ydif;
_root.target02._x -= xdif;
}


It pretty much works except the important line: if (_root.over_y = 400 { What I am trying to say here is if the y point of movie clip 1 is 400, then do whats under. Else do the other thing.

Any ideas? Thanks in advance.

A Move Clip As A Button?
I am interested in using a movieclip as a button
I tried this code but the MC does not appear
code:
HCgame.onPress=function(){
trace ("goodnight, nobody");
this._x=240;
this._y=0;
this._width=50;
this._height=250
_x=555;
_y=555;
}

I then attached the movie clip, it appears but does not act like a button

Move To HTML After Clip End?
is there any code that allow the page(say, a flash intro) go to next HTML page after the clip ends automaticly?

if not, is there html code to do it?

PLEASE HELP, Thanks

Please Help My Movie Clip Move The Right Way
Hi!
I have attached the file that I'm having problems with!
I would like my class to type the answer to the calculation in the box provided. If they get the answer right, the mouse should jump a little way up the hill and start to slide slowly back down again.
The sliding down part will act as a bit of a timer for the next question (the longer they take to answer, the further the mouse will have slipped back down the hill!)
I realise I have made the movie clip of the mouse incorrectly, as he slides up hill to his final place instead!
How can the children click 'CHECK' and the computer will jump the mouse 120 frames forward to his first jump point?
Also, how can it be animated so it slides slowly back down again?
Hope this makes some sort of sense!
Cheers
Chris

Move A Clip Around A Grid
Hi,

I'm using Flash 8.

Dumb question ... how do I move a movieclip around a grid (or predefined set of points/locations)?

I've tried it with the following code, and can get a movieclip to move from one location to another. But I can't get it to move from location 2 to location 3.

onClipEvent(load){
_x = 264;
_y = 274;

targetx = 264;
targety = 341;
}

onClipEvent(enterFrame){

function mover1(){
_x += (targetx - _x)/speed;
_y += (targety - _y)/speed;
clearInterval(time_1);
}

var time_1 = setInterval(this, "mover1", 2000);

}

I've tried various ways to get the clip move again to another location but, no way can I do this. Can anyone help?

Thanks!!

Move Clip Controls
I'm building a standalone flash website in Flash Proffesional 8, and I could use some help in the actionscripting.

I'm disecting a previous site to see how they used the actionscript but its confusing. This is what i'm looking at . .


_root.contact_btn2.onRelease=function(){
_root.section="contact";
_root.content_box_mc.attachMovie("blank_movie_clip ","blank_movie_clip",100);
}

My question: How can I use _root to load, and get to to sections of a movie clip ?

Copyright © 2005-08 www.BigResource.com, All rights reserved