Repositioning Conflict
I have an mc with the following code:
onClipEvent (load) { xcenter=495; speed=1/10; } onClipEvent (enterFrame) { var distance=_root._xmouse-xcenter; _x-=(distance*speed); if (_x > 1410) _x=1410; if (_x < -400) _x=-420; }
onClipEvent (enterFrame) { spd = 8; this._x += (endX-_x)/spd; }
On a couple of buttons within the mc, I have code like this:
on (release){ endX = -40; }
with various endX values. The buttons work perfectly. The sliding of the image (behind a mask) also works perfectly (when the mouse goes right the image slides left)... but, if I press one of the buttons and then try to slide across with the mouse, the movement is severely hampered, so that I can't move as far or as fast. I have a rough idea of why this is happening, but I haven't figured out a way to fix it. I'm hoping to launch this site in 8 hours so help is very much appreciated!
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 05-01-2005, 01:43 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Repositioning Conflict
I have an mc with the following code:
onClipEvent (load)
{
xcenter=495;
speed=1/10;
}
onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x-=(distance*speed);
if (_x > 1410) _x=1410;
if (_x < -400) _x=-420;
}
onClipEvent (enterFrame) {
spd = 8;
this._x += (endX-_x)/spd;
}
On a couple of buttons within the mc, I have code like this:
on (release){
endX = -40;
}
with various endX values. The buttons work perfectly. The sliding of the image (behind a mask) also works perfectly (when the mouse goes right the image slides left)... but, if I press one of the buttons and then try to slide across with the mouse, the movement is severely hampered, so that I can't move as far or as fast. I have a rough idea of why this is happening, but I haven't figured out a way to fix it. I'm hoping to launch this site in 8 hours so help is very much appreciated!
InfoObject Conflict Or Status Conflict?
I have a video player that shows a 'buffering video' image while the video is loading. I've added code to have it randomly select a different video to play at the end of the first one, and this causes the video buffer image to always show. If I move the buffer code down, the buffer will work, but the same video will play instead of loading a new one. I think this is a conflict with my ns.onStatus pieces; can someone assist me here?
Thanks in advance.
Here is the relevant code:
// Create the net connection
var nc:NetConnection = new NetConnection();
nc.connect(null);
// Create the net stream
var ns:NetStream = new NetStream(nc);
// Attach net stream to the video object
theVideo.attachVideo(ns);
// Play random video on load
filename = ["video1.flv", "video2.flv", "video3.flv", "video4.flv"];
path = "
XML Conflict, Or Level Conflict?
First, to get a brief visual of my conflict: shadow flash design Click on Action Script and either advanced or intermediate. Now, all the files load fine and give a preview in the right side window. All but the SinWave files. These are the only files used, thus far, with a call to the _root in some manner. That's all that seperates them from the others.
Here is the basic XML used for the sequences:
ActionScript Code:
///////////////////////////////
//set variable XML to parse
///////////////////////////////
function Advanced(){
ActionScripts = new XML();
ActionScripts.load("./XML/Advanced.xml");
ActionScripts.ignoreWhite = true;
ActionScripts.onLoad = findScripts;
findScripts();
}
function Intermediate(){
ActionScripts = new XML();
ActionScripts.load("./XML/Intermediate.xml");
ActionScripts.ignoreWhite = true;
ActionScripts.onLoad = findScripts;
findScripts();
}
function Beginner(){
ActionScripts = new XML();
ActionScripts.load("./XML/Beginner.xml");
ActionScripts.ignoreWhite = true;
ActionScripts.onLoad = findScripts;
findScripts();
}
//////////////////////////////////
//search the XML files
/////////////////////////////////
function findScripts() {
node_item = ActionScripts.firstChild;
var curr_item;
MenuItems = node_item.childNodes;
XMLindex = MenuItems.length;
for (var i=0; i<XMLindex; i++) {
curr_item = MenuItems.attributes.Scripts;
_root.Content.LTest.addItem(MenuItems[i].attributes.Name);
//and sort them in ascending order
_root.Content.LTest.sortItemsBy("label", "ASC");
}
//reset var "i" for further use
i = 0;
}
///////////////////////////////////////////////////////////
//begin functions for boxes
///////////////////////////////////////////////////////////
function ChooseXML(){
if(_root.Content.Ctest.getValue() == "Advanced"){
_root.Content.LTest.removeAll();
Advanced()
}
if(_root.Content.Ctest.getValue() == "Intermediate"){
_root.Content.LTest.removeAll();
Intermediate()
}
if(_root.Content.Ctest.getValue() == "Beginner"){
_root.Content.LTest.removeAll();
Beginner()
}
}
////////////////////////////////////////
//Define the on(release) for the listbox
///////////////////////////////////////
function listBox(){
i=0;
_root.Content.btnFLA._visible = true;
while(_root.Content.LTest.getValue() !== MenuItems[i].attributes.Name){
i++;
if(_root.Content.LTest.getValue() == MenuItems[i].attributes.Name){
var trial;
trial = MenuItems[i].attributes.Scripts;
LocUrl = MenuItems[i].attributes.loc;
break;
}
else{
continue;
}
}
//_root.Content.ScriptBox.text = trial; //MenuItems[i].attributes.Scripts;
if(MenuItems[i].attributes.Name == "Not Available"){
_root.Content.btnFLA._visible = false;
_root.Content.ScriptBox.text = "There are no items available. Check back, as we may be updating our database."
}
if(MenuItems[i].attributes.Name == ""){
_root.Content.btnFLA._visible = false;
_root.Content.ScriptBox.text = "";
}
else{
////////////////////////////////////////////////////////
//Begin setting the data to aprpriate areas on the stage
////////////////////////////////////////////////////////
//set text box for script with content
loadVariables(trial,_root);
//create function for the fla button
_root.Content.btnFLA.onPress = function (){
getURL(LocUrl + ".fla","_self");
}
_root.Content.mc_Clip.loadMovie(LocUrl + ".swf");
//reset "i" to 0
i = 0;
}
}
/////////////////////////
//call handle functions
/////////////////////////
_root.Content.LTest.setChangeHandler("listBox");
_root.Content.Ctest.setChangeHandler("ChooseXML");
////////////////////////////////////////////
//Start setting appearance of boxes
////////////////////////////////////////////
function lBoxAppearance(){
//_root.Content.LTest.backgroundColor = 0xFEFFD9;
_root.Content.LTest.setStyleProperty("shadow", 0x000000);
_root.Content.LTest.setStyleProperty("background", 0xC6D6E3);
_root.Content.LTest.setStyleProperty("darkshadow", 0x565A74);
_root.Content.LTest.setStyleProperty("highlight3D", 0x000000);
_root.Content.LTest.setStyleProperty("selection", 0x2FE2FB);
_root.Content.LTest.setStyleProperty("arrow",0xFFFFFF);
_root.Content.LTest.setStyleProperty("textSelected", 0x000000);
_root.Content.LTest.setStyleProperty("scrollTrack", 0xFFFFFF);
_root.Content.LTest.setStyleProperty("highlight", 0x000000);
_root.Content.LTest.setStyleProperty("face", 0x5885B1);
_root.Content.LTest.setStyleProperty("textSize", 10);
}
function SelBoxAppearance(){
//_root.Content.Ctest.backgroundColor = 0xFEFFD9;
_root.Content.Ctest.setStyleProperty("shadow", 0x000000);
_root.Content.Ctest.setStyleProperty("background", 0xC6D6E3);
_root.Content.Ctest.setStyleProperty("darkshadow", 0x565A74);
_root.Content.Ctest.setStyleProperty("highlight3D", 0x000000);
_root.Content.Ctest.setStyleProperty("selection", 0x2FE2FB);
_root.Content.Ctest.setStyleProperty("arrow", 0xFFFFFF);
_root.Content.Ctest.setStyleProperty("textSelected", 0x000000);
_root.Content.Ctest.setStyleProperty("scrollTrack", 0xFFFFFF);
_root.Content.Ctest.setStyleProperty("highlight", 0x000000);
_root.Content.Ctest.setStyleProperty("face", 0x5885B1);
_root.Content.Ctest.setStyleProperty("textBold", true);
_root.Content.Ctest.setStyleProperty("textAlign", "center");
}
/////////////////////////
//call appearance change
/////////////////////////
lBoxAppearance();
SelBoxAppearance();
The actual xml code is even simpler:
HTML Code:
<?xml version="1.0"?>
<menu Difficulty="Intermediate">
<Link Name="" Scripts="null" loc="null"/>
<Link Name="Text Typing" Scripts="./SourceCode/TypeingText.txt" loc="http://www.shadowflashdesign.com/FLAsource/TypeingText"/>
<Link Name="Preloader 01" Scripts="./SourceCode/Preload1.txt" loc="http://www.shadowflashdesign.com/FLAsource/Preload1"/>
<Link Name="Shape Easing" Scripts="./SourceCode/EasingBasic.txt" loc="http://www.shadowflashdesign.com/FLAsource/EasingBasic"/>
<Link Name="Sin Wave 01" Scripts="./SourceCode/SinWave01.txt" loc="http://www.shadowflashdesign.com/FLAsource/SinWave01"/>
</menu>
Pretty simple to follow, I hope. Now, in order to load the SinWave01, SinWave02 the above should work effectively. As we have seen, it does not.
The SinWave code in actionscript is upon a couple of levels(movieclips):
The First movie clip carries the following:
ActionScript Code:
onClipEvent (load) {
var numberToDuplicate = 760;
// variables for the sine wave calculation
var amplitude = 22;
var period = 15;
var phaseShift = 10;
//distance to move along the x axis
var incrementSpace = 2;
// color of the Square
var squareColor = new Color(square);
squareColor.setRGB(0x3366FF);
//duplicate Squares
for (var i = 0; i<numberToDuplicate; i++) {
Square.duplicateMovieClip("sq"+i, i);
var clipName = this["sq"+i];
clipName.position = i;
clipName._x = i*incrementSpace;
// calculate the y-position
clipName._y = -amplitude*Math.sin(_root.Deg2Rad*(period*i+phaseShift));
}
Square._visible = true;
}
Within that movie clip is another with this code:
ActionScript Code:
onClipEvent (load) {
//calculate shading
var myDegree = (_parent.period*position+_parent.phaseShift)%360;
if (myDegree>=0 && myDegree<180) {
_alpha = myDegree*_root.alphaChange;
} else {
_alpha = (360-myDegree)*_root.alphaChange;
}
}
onClipEvent (enterFrame) {
// increment position on the sine wave
position++;
// move object over on x axis
_x += _parent.incrementSpace;
// Check if off the stage on right, move clip to far left of stage
if (_x>Stage.width) {
_x -= _parent.numberToDuplicate*_parent.incrementSpace;
position -= _parent.numberToDuplicate;
}
// calculate new y position
_y = -_parent.amplitude*Math.sin(_root.Deg2Rad*(_parent.period*position+_parent.phaseShift));
}
And, of course, the initial Math variables are set in frame 1 of the _root of the movie:
ActionScript Code:
// conversion from degrees to radians
Deg2Rad = Math.PI/180;
//alpha change based on 1/2 rotation
alphaChange = 100/180;
I've altered the SinWave scripts to give direct pathing to the modular movies in the website, but that doesn't seem to have any effect.
As the scripts will be getting much more complicated in a short period of time, and it is for the benefit of new Action Scriptors, I need help finding the cause of this problem so as to avoid it in the future.
Repositioning _x
I have the following function:
button2.onPress = function() {
button1.onEnterFrame = function() {
this._x -= (this._x-temp1)*.3;
};
};
So, by pressing button2, button1 slides to a certain x coordinate.
After button1 stops moving, i want to run a function that sends button1._x to a new location. (Not sliding, just an immediate cut)
Any ideas?
Repositioning Duplicated MC's
I have a dynamic number of duplicated movieclips, arranged in a line horizontally.
When you rollover one an OnClipEvent script enlarges the clip, and depending on where it is, alters the clip's _x position, causing potential overlapping.
How do I tell the other movieclips (assume there's five) to shift their own _x in relation to the clip I have rolled over, so that there will be no overlapping?
thanks people.
Multiple MCs Repositioning.how?
i have this:
for (i=1; i<4; i++) {
for (j=1; j<5; j++) {
createEmptyMovieClip("box" add i add j, 11);
loadMovie(i add j add ".jpg", "box" add i add j);
box = "box" add i add j;
box._x = (i-1)*(68+14.2);
box._y = 23.9+(j-1)*(120+25.2);
}
}
and this is the problem: box = "box" add i add j;
it won't set the box MCs pozitions by using the var above
i want to move each of the boxij MCs
but i don't want to write a line for each box12 box13 bla bla...
Smoothly Repositioning
Hi guys,
Im trying now for the past week to make two movies to move to different predetermined position at a click of a button.
Like: Push B1 MC A moves to left, MC B moves to right.
The structure its a bit more complicated as I have six buttons and the MC’s have to go smoothly from location to location. I've tried with _X but it doesn't makes it smoothly but instead jumps to the position. And it has to “flow”...
If you have any solution/idea/tutorial please advise me,
Thanks
R
[F8] Repositioning Everything In Movie....
Hi Everyone....
Im in a bind... I created a flash movie... but now, after the fact, I want my movie size to be larger. Now that I made the document a larger size, I seem to have to re-position EVERYTHING and every keyframe back to the center of my movie. is there any way at all to get everything centered again without going on every keyframe/movie and re-positioning it? any other short cut to this?
thanks
-Allison
Repositioning Several Items At Once
Hello!
I am trying to create a timelapse, using 250 photos imported into Flash. I am copy and pasting them from another Flash document into a new one and the timelapse needs to have specific coordinates on my stage. When I select all the frames and try to move the photos on the stage, only the first one moves. Please tell me I do not have to reposition 250 photos manually?
Thank you so much.
Video X Y Repositioning On Its Own
Has anyone seen video repositioning itself differently from the x and y assignments that were scripted?
Basically, I have to show a video then have a quiz. Once the quiz is passed, the user can move to the next subject. Then they watch a video then take a quiz, thus repeating for four subjects. The students must have the ability to go back and watch previous videos at anytime after they have completed them. the problem is, when the video loads the next time around, it's not in the correct position. I have traced the x and y positions, and the trace reads correctly, but the video has moved. The challenge is making the video go away and come back so the quizes can be taken. I've tried removing the child as well as just positioning the flvplayback off screen. It still repositions itself. Here is a basic example of my code (note - layoutTwoFinished is false until the quiz is passed. Therefore, after the quiz is completed, a true is passed everytime this subject is accessed again. Also vid3 is declared on frame one.):
frameLoad = 3;
if(layoutTwoFinished == false)
{
trace("Frame 3 - conflict LayoutOneFinished = false");
var frame3_xml:XML;
var xmlReq_3:URLRequest = new URLRequest("ethics_xml/ethics101_conflictInterest.xml");
var xmlLoader_3:URLLoader = new URLLoader();
xmlLoader_3.load(xmlReq_3);
xmlLoader_3.addEventListener(Event.COMPLETE, xmlLoad_3);
}
else
{
trace("Frame 3 - conflict LayoutOneFinished = true");
//vid3.x=0;
//vid3.y=0;
vid3.x=200;
vid3.y=370;
vid3.play();
Active_Title.text = frame3_xml.title;
frameLoad = 3;
menuReset();
trace("vid3.x = " + vid3.x);
trace("vid3.y = " + vid3.y);
}
function xmlLoad_3(event:Event):void
{
trace("xlmLoad_3");
frame3_xml = new XML(xmlLoader_3.data);
Active_Title.text = frame3_xml.title;
vid3.source = frame3_xml.video.source;
addChild(vid3);
vid3.skin ="ethics_misc/EthicsSkin.swf";
vid3.scaleMode = "noScale";
vid3.skinBackgroundColor=0x4e77a7;
vid3.x=200;
vid3.y=370;
vid3.skinAutoHide=true;
vid3.autoRewind = true;
vid3.play();
currentMenuColor = textFormat3;
vid3.addEventListener(Event.COMPLETE, closeVideo3);
}
function closeVideo3(event:Event):void {
trace("closeVideo3");
//removeChild(vid3);
vid3.x=-400;
vid3.y=-570;
vid3.stop();
if(layoutTwoFinished == false)
{
runQuiz(frame3_xml, 3);
}
else
{
textArea1.text = frame3_xml.page;
}
}
To make things even weirder, I tried relocating the y to 37 instead of 370 and the video will always return to the assigned coordinate (37) correctly. But at 370 it repositions.
Any help would be grateful.
Repositioning Mouse
Is there a way i can repositon the mouse?
Iam working on an interface that requires the mouse pointer to begin from a certain area of interface.
Problem Repositioning MC’s Along _y
I have 2 MC’s named “box1” and “box2”. Each one has dynamic text field named content_txt (content_txt.autoSize = true) and loads some text data from XML file.
Box2 is on the top and box1 on the bottom. I need function that checks the height of box2, or of it’s content_txt and puts box1 on exact distance along _y axis.
I have tried with this code:
Code:
onEnterFrame = function () {
b1y = box2._y;
b1v = box2.content_txt.height; //or just box2.height
spacer = 20;
total = b1y + b1v + spacer;
box1._y += 5;
if(box1._y>total){
box1._y=total;
}
}
but it slides box1 without exact calculating of box2 height.
Repositioning Problem
Hi
working on this tutorial:
http://www.kirupa.com/developer/mx2004/thumbnails.htm
when I tried to reposition or to load into another .swf file , it works strange
???
Thanks for your help!
Stage Repositioning? Help, Please...
Ok,
So what I'm trying to do now is write a function (probably an onEnterFrame, unless you think it should just be called each time) that repositions and, if necessary, resizes movie clips. The catch is that the stage wont always be the main stage so Stage does not apply here. Right now I'm using the Loader component to house these movie clips, and later on they will be in their own swf.
That being said, what kind of function do you think would accomplish this? I need to be able to specify the stage width and height, like so:
ActionScript Code:
something.function(param, param) {}
Much appreciated...
Repositioning Mouse
Is there a way i can repositon the mouse?
Iam working on an interface that requires the mouse pointer to begin from a certain area of interface.
Repositioning All Objects
Hi there,
I bought a flash template from template monster. I would like to move everything up by 50px but if I select all, some objects still in the original position. How dow you change it globally?
This is the template : http://www.templatemonster.com/flash...tes/13087.html. I'm trying to reduce all the top and bottom space so everything fit in one screen without having to scroll down.
Thanks
Action After Repositioning?
hi,
I'm using a function to animate a MC's position and I was wondering if I can trigger an action once it has reached it's location.
My Function:
ActionScript Code:
///Reposition
onClipEvent (load) {
this._parent.targ1 = 230;
}
onClipEvent (enterFrame) {
cX = this._x;
difZ = cX-this._parent.targ1;
setProperty(this, _x, cX-(difZ/4));
}
and I trigger it with this:
ActionScript Code:
_root.targ1 = (-340);
Is there a way to start another action once my item has reached -340 on the x-axis?
Al
Repositioning Movieclip From One Side To The Other
Any suggestions for this one...
I am trying to create some animated bugs that randomly walk about. When they walk over the edge of the movie area, I want them to reappear on the other side after a couple of seconds delay.
The problem is that they sometimes seem to disappear from the screen before they've reached the edge and sometimes reappear unexpectedly.
I don't know if this is because they are all instances of the same moviclip ("bug") and start off positioned at different points and with different rotations.
Please have a look:
http://www.angelfire.com/sk/monkeypuzzle/flash/bugz.htm
You can track the _x and _y co-ordinates and other variables for the different bugs.
My movie is 550px wide x 400px high.
The relevant script on the movieclip:
if (this._x >= 650){
this._x = -50;
}
if (this._x <= -60){
this._x = 640;
}
if (this._y<=-100) {
this._y = 490
}
if (this._y>=500) {
this._y = -90;
}
Thanks a lot for your suggestions,
Prem.
Resizing And Repositioning A MC Proportionatly
I have 5 rectangle movie clips that are each 20% of the total height of all five. If you click on a mc it should expand to 80% and the others resize to 5%, also the _y position of the mc = _y of above mc + the _height of above mc. And subsiquently if you click on a 5% it will resize and reposition to 80%. Also if you click on the 80% mc it will return all to 20%
Repositioning External JPEG
I'm creating an interactive CD-ROM portfolio, but I have run into a problem. In one section, I am having an art gallery, which right now is loading external JPG's from the 'Images' directory on my hard drive. This has a reletive relationship with the SWF, so it'll work on CD-ROM.
I've added this script to reposition the Movie Clip depending on its size once the JPEG loads. This script is on the main timeline.
loadMovie(["images/" + image + ".jpg"], "image");
setProperty(image, _x, 240-((image._width - 550)/2));
setProperty(image, _y, 72-((image._height - 400)/2));
However this is not working. Clips are always set to 515 (X), 272 (Y). According to trace actions, the clip is 0 pixels across and 0 pixels high.
Effectivly, I would like for example a JPEG 500 by 340 pixels to load, and be repositioned to 530 (X), 242 (Y) (I think...)
Any ideas where I am going wrong? PLEASE help me!!! :P
Repositioning An Externally Loaded Swf
When I load an external swf file using the following code....
loadMovie(""blah.swf","_level2");
How do I then target that loaded movie so I can reposition it soemwhere else on the stage ? Does it have a reference name ?
Cheers
Thanks in advance
Repositioning MCs A La Apple's Dock
Apple's Dock is a great example to convey the functionality I'd like to have. Those running OS X know that when you add or remove an icon from the Dock all the other icons shift out of the way to make room for the new one.
I'm looking to do something similar here. For instance, I have some text, "CAUTIONS" and a number afterward. So beginning it would be "CAUTIONS 0". If a caution happens then the text will read "CAUTIONS 1" and an arrow will be placed next to it. Now there is text and movieclips to the right of this caution text. I would like everything to move/slide to make room for whatever dynamic updates there are. Likewise when everything is "reset" these arrows would disappear, text defaulted back, and everything moves/slides back to it's starting point.
Any takers for general concepts or code examples?
m/
Smooth Repositioning Using MOVEY:)
Hiya,
I was able to put the script together for this menubar in the attached file... It floats on a seperate level just fine, but what I want is for it to smoothly move to the top of the page when a button is clicked, and stay within a two inch range. As you can see, it moves to the top of the page... but surely does not do it gracefully... it just jumps up there.
Not really sure how to put the rest of the script together for this... not really sure if it's even possible. Any insight would be greatly appreciated...
Peaceout!
Smooth Scaling/Repositioning
I have an mc that i want to scale smoothly, see attached image that explains it...
heres my code
ActionScript Code:
shrinkMap = function (target_MC:MovieClip, target_WDTH:Number, target_HGHT:Number, target_X:Number) { target_MC.onEnterFrame = function() { if (target_MC._width>target_WDTH) { target_MC._width -= target_MC._width/20; } else { target_MC._width = target_WDTH; } // if (target_MC._height>target_HGHT) { target_MC._height -= target_MC._height/20; } else { target_MC._height = target_HGHT; } // if (target_MC._x<target_X) { target_MC._x += (target_X-target_MC._x)/5; } else { target_MC._x = target_X; } if (target_MC._width == target_WDTH && target_MC._height == target_HGHT && target_MC._x == target_X) { delete target_MC.onEnterFrame; } // };};
It looks really jerky, the different bits finish before each other...is there a way of making each bit (height width and x) scale in proportion of each other so they all finish at the same time? I bet its something to do with what i divide the -= values by (currently arbitrary numbers like 20 or 5)
Repositioning/Sliding Menu
I am having trouble creating a certain type of menu. I want to have a certain amount of bars lined up one after another, vertically. Then when you click on a bar it disappears and the ones below it slide up to fill the gap. Then when you click on another bar, the one that has disappeared's original spot grows to fit it back in the same spot, then the process is repeated...i hope that makes sense.
Ive posted a swf of what im trying to get at, except the bar doesnt disappear, only one bar usually moves, and the gap doesnt grow back before the bar resumes its original position.
http://img168.imageshack.us/my.php?image=barmovepy3.swf
Thanks for any help
Repositioning Movieclips On Resize
Does anyone know how to reposition the items on the stage like
http://www.hellohikimori.com/
I know how to just move the items onResize, but I want to have the effect of waiting till the resizing has finished before the items move, and how the items bounce in using a Tween.
Any Suggestions.
:: Repositioning An Object, On ALL Keyframes :::
hi there
more questions.. havent been able to figure this one out, but im sure its very easy.. I have a timeline with an object and some keyframes.. I would like to move all the keyframes to a new location at once? instead of copying and pasting the new coordinates on each keyframe?
thanks a million
Mats
URGENT: Repositioning Checkboxes
How do you reposition checkboxes within the quiz template in FlashMX so they will stay where placed on the stage at run time???
I need to be able to place the checkboxes of a multiple choice question at specific locations – not at the locations determined by actionscript at run time when the mc_checkbox loads. My boss wants me to create a multiple choice question in the form of a table – each row has 3 possible answers – of course only 1 checkbox per row is the correct answer
My table works great as long as it is the only multiple choice question in the quiz. As soon as other multiple choice question are added my checkbox locations return to their default position – left side and in a perfect line; not what I want. How can I disable this feature? I need the checkboxes to stay where I place them.
Tried locating code for checkbox placement (x, y)…found label size, label placement and text attributes but nothing indicating position of checkbox at run time. Undoubtedly I’m looking in the wrong place. Please help! (I know the mc is geeting AS instruction as to placement on stage) Did not find anything addressing this in my search. Thanks for your assistance with this matter...
Resizing And Repositioning MC Proportionatly
Last edited by NewEzra : 2002-11-14 at 07:54.
I have 5 rectangle movie clips that are each 20% of the total height of all five. If you click on a mc it should expand to 80% and the others resize to 5%, also the _y position of the mc = _y of above mc + the _height of above mc. And subsiquently if you click on a 5% it will resize and reposition to 80%. Also if you click on the 80% mc it will return all to 20%
I finally figured out how to create this effect, but I know that the actionscript and the method used could be optimized. I am still very new to actionscript.
Here is the prototype of the effect: Prototype v1
Here is the fla
Repositioning An Object Inside A Mc And Replaying The Same Mc
if i have a movie clip with a tween such as a box moving across a screen, and i also have a button that's suppose to reposition the box and give it a new position. how would i replay that same movie clip with the box beginning at the new position and tween it the same distance? just 1 movie clip though going from frame 1 to 10. this is going to be a loop eventually having the user click on a button and the box moving slowing across the screen and stop until the user click again.
is there anyway of going about it? thanks.
Repositioning Content When A Movie Is Resized
I was reading the technote at moock's technote and I was trying to have a horizontal line going across the screen. And resizing as the screen resizes.
Can it be done using attachMovie?
Any ideas?
Repositioning Text For Smaller Components
How do I reposition component text if I want my components to be smaller than the default size?
I'm using the SampleTheme style and would like to make my components (in particular my TextInputs and ComboBoxes) smaller than the default size. Shrinking the components and the text size is easy enough, but when you do that, the text doesn't reposition itself to the new size, so it ends up being vertically uncentered and even cut off. How do I fiddle with those settings?
I'm using Flash MX 2004 Professional.
_height Resizing Causing Repositioning
I'm running into a problem that occurs when I try to resize a graphic. I'm pretty sure this is just something goofy I'm doing and don't realize it.
There's a movieclip called scroll_content, and inside is a textbox created by ActionScript with text loaded from a database. The textbox is resized and reformatted, and the background graphic (the troublemaker) is resized to be slightly longer than the text.
The problem is that the background graphic *looks* like it's being repositioned hundreds of pixels up on the stage. In other words, the y value seems to be reduced dramatically.
PHP Code:
// Load the text
var loadedText = new LoadVars();
loadedText.onLoad = function(success) {
if(success) {
trace("Text loaded!");
resizeMe(this.anntxt);
} else {
trace('Why aren\'t they loading?');
}
}
loadedText.load("announcements.php");
function resizeMe(str) {
// Text Formatting
var formatting:TextFormat = new TextFormat();
formatting.font = "ThisIsTheFontToUse"
formatting.size = 10;
formatting.color = 0xFFFFFF;
// Get metrics info for the text
var metrics:Object = formatting.getTextExtent(str, 209.9);
// Create the text field using metrics
createTextField('textfield',this.getNextHighestDepth(),-87,-78.5,209.9,metrics.textFieldHeight);
textfield.multiline = true;
textfield.wordWrap = true;
textfield.embedFonts = true;
// Place the text in and format the box
textfield.text = str;
textfield.setTextFormat(formatting);
trace('Old Y:'+bg._y);
bg._height = textfield._height;
trace('New Y:'+bg._y);
}
stop();
The output window shows that the bg movieclip's y position stays the same... but how could this be? What I suspect is this has something to do with the Symbol Position controls in the info window (I really don't know how to use those). Attached are images of what the background graphic is doing, unmasked.
Dumb Question- Repositioning External?
I am loading in an external movie (swf) using:
Code:
loadMovie("info.swf",1);
Now I wanna reposition this. can't I just say
Code:
_level1._x = 300;
?????
Stage Repositioning Problem In Browser
Hello!
I'm hoping that someone can help me figure out what the heck I'm doing wrong here..I've been working on this beast for three days and nothing is panning out.
I'm using the following code to center the contents of my stage ("content") while stretching a background movie clip ("bg")
It works beautifully when the movie first loads into the browser BUT if the viewer resizes the browser, the whole thing goes out of whack. Yes, I have the registration point in the upper left corner.
__________________________________________________ ___________
Stage.scaleMode = "noScale";
Stage.align = "LT";
bg.onResize = function() {
this._width = Stage.width;
this._height = Stage.height;
};
Stage.addListener(bg);
bg._x = bg._y = 0;
bg.onResize();
content.onResize = function() {
this._x = (Stage.width - this._width) / 2;
this._y = (Stage.height - this._height) / 2;
};
Stage.addListener(content);
__________________________________________________ ___________
To see what I"m talking about, go to www.studiosixdesign.com/newmath. Upon opening, it works great. BUT if you resize the browser, it throws the content into disarray.
Help, please! I'm about to pull my hair out!
Unusual LoadMovieNum Repositioning Issue
Trying to load some old swfs into a new Flash project by using the loadMovieNum via a button.
I did these swfs 4 years ago as part of something else, back then I just created a new stage the same size as my level_0 main movie (800x600) and positioned them in the right place on a blank back.
In my new project (also 800x600) they don't line up exactly, so I need to reposition the x & y points.
They are big movie clips so I don't want to have to import them and make swfs again which will be incredibly time consuming, just want to move them so they line up into my content space.
Here's the code I've already tried but the clips dont move at all:
on (release) {
loadMovieNum("movies/old_movie1.swf", 300);
var xset = 270;
var yset = 250;
}
I wonder if its because the clips are the same size (800x600) that they don't want to move.
Ideas?
Looping Through 2 Arrays And Repositioning Movieclips
I have a mad-lib type page that I am trying to put together. There are 27 words that have all been converted to movie clips named word1, word2, etc., that make up my first array. There are 3 layers inside each movie clip: a 'hit' layer, a text layer, and a bg layer. The on mousedown event grabs the hit layer. The second array has 6 items in it called blank1, blank2, etc. I am doing a hitTest so that if one of the words is over the blank it will snap to the blank movie clip x, y position. I am having major difficulty getting the movie clip to snap back to its original position if the hitTest is false. My code is below.
Also, there is a reset button that is supposed to send the words back to their original position but I'm not sure how to do that outside of the for loop.
Thanks!
Attach Code
stop();
var main:DisplayObject = this;
buttonMode = true;
function init():void{
for(var i:uint = 1;i<28;i++){
main["word"+i]['hit'].addEventListener(MouseEvent.MOUSE_DOWN,wordClick);
main["word"+i]['hit'].addEventListener(MouseEvent.MOUSE_UP, wordRelease);
main["word"+i].oX = main["word"+i].x;
main["word"+i].oY = main["word"+i].y;
}//end for
}//end init
function wordClick(e:MouseEvent){
e.target.parent.startDrag();
}//end word Click
function wordRelease(e:MouseEvent):void {
for (var n:uint = 1; n<7; n++) {
if (e.target.parent.hitTestObject(main['blank'+n])) {
e.target.parent.stopDrag();
e.target.parent.x = main['blank'+n].x;
e.target.parent.y = main['blank'+n].y;
e.target.parent['bg'].alpha = 0;
} else {
e.target.parent.stopDrag();
}
}//end for loop
} //end wordRelease
init();
Having Trouble With Flash Gallery When Repositioning
the gallery I downloaded from http://www.kirupa.com/developer/mx20...togallery9.htm
has a problem that I cannot solve
when I increase the carvas size to 1000 by 700, and I move the whole gallery to right at the center of the carvas, and then I test movie, it ceased working, when I undo the last step, it fix itself, I just don't understand, I read through the code, nothing is really concerning the carvas size, but it's just so weird, help!!
Looping Through 2 Arrays And Repositioning Movieclips
I have a mad-lib type page that I am trying to put together. There are 27 words that have all been converted to movie clips named word1, word2, etc., that make up my first array. There are 3 layers inside each movie clip: a 'hit' layer, a text layer, and a bg layer. The on mousedown event grabs the hit layer. The second array has 6 items in it called blank1, blank2, etc. I am doing a hitTest so that if one of the words is over the blank it will snap to the blank movie clip x, y position. I am having major difficulty getting the movie clip to snap back to its original position if the hitTest is false. Here is my code:
Code:
stop();
var main:DisplayObject = this;
buttonMode = true;
function init():void{
for(var i:uint = 1;i<28;i++){
main["word"+i]['hit'].addEventListener(MouseEvent.MOUSE_DOWN,wordClick);
main["word"+i]['hit'].addEventListener(MouseEvent.MOUSE_UP, wordRelease);
main["word"+i].oX = main["word"+i].x;
main["word"+i].oY = main["word"+i].y;
}//end for
}//end init
function wordClick(e:MouseEvent){
e.target.parent.startDrag();
}//end word Click
function wordRelease(e:MouseEvent):void {
for (var n:uint = 1; n<7; n++) {
if (e.target.parent.hitTestObject(main['blank'+n])) {
e.target.parent.stopDrag();
e.target.parent.x = main['blank'+n].x;
e.target.parent.y = main['blank'+n].y;
e.target.parent['bg'].alpha = 0;
} else {
e.target.parent.stopDrag();
}
}//end for loop
} //end wordRelease
init();
Also, there is a reset button that is supposed to send the words back to their original position but I'm not sure how to do that outside of the for loop.
Thanks!
Resizing And Repositioning, 100% Flash Page
I feel like I'm approaching this wrong. Every time I create a new MovieClip. I have to go into my resize listener function and type in
Code:
newmc._x = Stage.height/2;
newmc._width = Stage.width;
etc... or something like that depending on where I want it positioned.
Is there a simpler method or is this the only way if I want to keep everything positioned nicely if someone decides to resize the browser.
Repositioning Scaling, Nested Movieclips
Hi all,
I am working on a zoomable interface that is inspired by the functionality of the navigation scheme at relevare.com. My "rough draft" prototype is very close to achieving the desired zooming effect, but I am having a little difficulty positioning scaling, nested movieclips properly.
Basically, I start with several movieclips nested in varying degrees within a container movieclip. When any clip is clicked on the first time, the container is coded to scale up and reposition itself so the selected clip appears enlarged and centered on the stage. Clicking on that clip again returns the container to its original size and position. This process is working, and various factors are taken into account... the center of the stage, the original center of the selected clip, the distance between these two centers, the necessary scaling factor, and the amount the container must be moved on the x and y axes.
However, after I click on one clip and the container is scaled up and positioned properly, clicking on a second, nested clip results in the container scaling up again OK but the position is incorrect. There seems to be another factor that needs to be accounted for, which I am guessing is the new "offset" center of the scaled container itself (originally, the center of the unscaled container was equal to the center of the stage).
If it helps, I have posted the code and an example of my "rough draft" prototype at http://www.brianwaters.com/public . Clicking on any one clip (A, B, C, D, A1, A2) and then clicking on it again works as expected. But if you click on A and then click on A1, you can see the problem, which has me stumped. I have been modifying the moveX and moveY values to account for the new center of the scaled container with interesting results, but no success.
If anyone has any advice on how to correct this, or can recommend a resource (tutorial, swf, etc.) for me to check out, it would be greatly appreciated! (I have seen tutorials that demonstrate scripted movement, but throwing scaling into the mix really seems to complicate things.) Thanks in advance!
Cheers,
Brian
Dynamic Positioning And Repositioning Of Movieclips
hi there
i am trying to write a layout algorhythm in actionscript for a "word" cloud - like http://www.wordle.net see attachment...
am thinking of doing initial layout with hit test ..... not sure if this will successfully 'justify' the movieclips
but then i want to add new movieclips (words) as and when and for them to 'squeeze' into spaces (thus pushing others out)........ a bit like apples bobbing in a bucket....
any ideas... has anyone attempted anything similar......
thanks a million
andy
Repositioning A Movie Clip Inside Main Mc
might be a stupid question but...
i have a main mc, with another mc nested inside it that needs to reposition to exact x,y coordinates(on four separate occasions). can i put keyframes on the timeline with a script placed on the keyframes so that when my main movie reaches those frames, the nested mc repositions to the specified coordinates?
wait - i know i can do that
i need the script to do it with?
any help would be greatly appreciated
thanks
craig
Full Page Flash Repositioning Issues
Project Using Flash 8
AS2
SWFObject
Hello everyone...I have an issue where I have a main movie (Full Browser Flash site)...and within that movie I have the global navigation, and a container for loading all of the external pages...and both of these items are centered horizontally (I locked vertical movement)
The container is 500x500 and the external movie's stage size is set at exactly 500x500 as well...and all works fine up to this point…
However, when I add elements in the external movie clip "off stage" (like a clip flying in from the side) the main movie container includes these items in measuring “total _width of the external clip) which causes the size to change from 500x600 to something like 560x500
This is a serious problems with centering the container clip as these items don’t actually appear in the flash movie (masked in)…so the external clip ends up looking “off center” ...when the stage is resized (Yes..i have a function that is tweening movement on stage resize…and it works fine as long as the ext clips dont have items off stage that increase the loaded width/height within the container)
Basically, everything works fine until I add items off stage in the external MC's, but I will need to do this...
I can’t figure out what I’m missing here, or how to get around this, any help would be really great!
Repositioning/aligning Movie After Re-sizing Stage?
I would like to resize my stage area, then re-position my movie to align with the new stage size. How can I do that?
I have a flash header with a menu system at the bottom of the flash header. On all the pages beyond my index page I would like to only use the menu system at the bottom of my header movie.
any suggestions would be great
Repositioning Objects From Array Variable Data
I'm doing a "for" loop through an array and would like the objects identified in the array values to be re-positioned and change color.
I got the color change figured out, but am having trouble with the re-positioning.
I am using this method
var = "_root."+strObject;
var._x -= 5;
var = "_root."+strObject;
var._y -= 5;
With each loop through the array the value of "strObject" changes
"strObject" identifies different MovieClips placed on the main stage labeled with Instance Names that match the strObject value.
I can't figure out why it is not working. Is there something else I might use, like a "setPosition" method?
Thanks for any help...
-Robert
Full Page Flash Repositioning/Sizing Issue
I have a main movie (Full Browser Flash site)...and within that movie there is a global navigation and a container for loading all of the external pages...Both of these items are centered horizontally (I locked vertical movement)
The container is 500x500 and the external movie's stage size is also set at exactly 500x500...
The problem: When I add elements in the external movie clip "off stage" (like a clip flying in from the side) the main movie container includes these items in measuring total "_width" of the external clip which causes the size to change from 500x600 to something like 560x500 ...even though I have the stage size in the external movie set correctly at 500x500
This is a problems with centering the container clip as these items don’t even actually appear in the external movie until they hit the stage (masked in)…so the container ends up looking “off center” wihtin the main movie ...when the stage is resized (Yes..i have a function that is tweening movement on stage resize…and it works fine as long as the external clips dont have items off stage that apparently increase the loaded width/height within the container)
Basically, everything works fine until I add items off stage in the external MC's, but I will need to do this...
Any help would be great, thanks
[MX04] Repositioning Multi-layer Tweened Objects
Okay, I'm in Day 2 as a Flash user, I've created an animation consisting of multiple layers, each containing at least one motion tween (most using symbols).
I now discover that I made the stage/document dimensions too large for my intended purpose and after resizing the dimensions to the correct size, am encountering difficulty in repositioning the entire animation so it is "on-stage". I can't even seem to get the entire animation into a symbol to do it that way.
Li'l help?
|