View Full Version : frame properties
xxlfm
07-28-2007, 08:42 PM
I feel very stupid, I could not get into Frame Properties. ( I am using Flash Professional 8)
Basically I want set varibales to capture the move clip's original postion. http://kb.adobe.com/support/flash/ts/documents/set_variables/setvariable.gif
The source said as the follwing:(http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14253&sliceId=2)
To set a variable using "Set Variable":
Open a new document in Flash.
Highlight Frame 1 in the timeline.
Choose Modify > Frame from the menu.
In the Actions tab, click the "+" sign, and choose "Set Variable".
In the "Variable" field, type "text" without quotes. This is the variable name.
In the "Value" field, type "hello" without quotes.
Click OK.
Choose Control > Test Movie to test this. The variable named "text" will be assigned the specified value "hello" when the movie plays the first frame of the timeline.
Also, in this example, setting the variable will not show any visual change in the movie. However, variables and their values can be previewed in Test Movie mode by choosing Control > List Variables.
I spent about one hour and could not get into Frame Properites. I could not find the Frame under Modify...
What did I miss? thanks for any help in advance.
Medyman
07-28-2007, 09:24 PM
Hello,
Well first of all, you're using instructions for Flash 4. The interface as changed drastically since Flash 4.
What exactly are you trying to do? Have a variable record the _x or _y coordinate of a particular movieclip?
To do this, you'll want to set up two variables (one for the x and one for the y)
Example:
var mcX:Number = myMC._x
var mcY:Number = myMC._y
Where myMC is the name of your movieclip
xxlfm
07-29-2007, 02:39 AM
ok, I am doing shop cart by dragging the picture (mc) into cart and I want to pass the original position to movie clips.
in main sence1, I set the variables to capture the original mc x and y by:
var top_x:Number = getProperty("/top", _x);
var top_y:Number= getProperty("/top", _y);
in my picture mc (top) I have the code:
on (press) {
startDrag("/top");
tellTarget ("/topfader") {
nextFrame();
}
}
on (release, releaseOutside) {
stopDrag();
if (getProperty("/top", _droptarget) eq "/cart") {
trace (top_x);
setProperty("/top", _visible, 0);
tellTarget ("/topfader") {
play();
}
} else {
trace (top_y);
setProperty("/top", _x, top_x);
setProperty("/top", _y, top_y);
tellTarget ("/topfader") {
gotoAndStop(1);
}
}
}
my problem is I could not get the top_x and top_y (undefind), so the piture is not snapping back to the original position.
Should I use the get/set Property functions?
Thanks, Medyman!
It's working when I put this._parent in front of top_x, but not root, why?!! I thought the parent of mc is the root....:eek:
Medyman
07-29-2007, 01:40 PM
This is because the variable is defined on the root timeline and you are calling it from a movieclip.
If this._parent works and _root doesn't then you might be further embedded MC than you think. Try doing a trace(this) and se what you get.
Also, the SetProperty and and tellTarget functions are very very old syntax. I don't recommend them.
Instead you can hard code the _x and _y values and even add a tween animation if you choose to make it more visually appealing.
I'll post a code snippet in a bit of how to properly code it (kind of have to go right now)
Medyman
07-29-2007, 03:08 PM
I don't quite understand what you're trying to do. Mostly because you're using really old syntax that was already outdated when I started with ActionScript and I never learned it.
But this is what I think you're meaning to do:
var top_x:Number = pictureMC._x // Sets top_x to the x coordinate of pictureMC
var top_y:Number = pictureMC._y // Sets top_y to the y coordinate of pictureMC (by default the top left corner, but make sure to check Reg points)
pictureMC.onPress = function() {
this.startDrag(true) // starts dragging of pictureMC
topfader.gotoAndPlay(_currentframe++) // tells topfader to go to next frame & play
}
pictureMC.onRelease = pictureMC.onReleaseOutside = function() {
stopDrag();
if ( top._x == cart._x) { // Checks to see if the _x property of top is equal to cart
top._visible = false; // sets top visible to false (i.e. makes it invisible)
topfader.gotoAndPlay(framenumber); // plays setfader
}
else {
top._x = top_x; // sets top's x coordinate to top_x
top._y = top_y; // sets top's y coordinate to top_y
topfader.gotoAndStop(1); // takes topfader to frame 1 and stops
}
}
Put this on the root timeline.
THis assumes that all of your MCs are on the main timeline. By your description, they are not so make sure you're pointing to them correctly.
xxlfm
07-30-2007, 08:03 PM
Thanks, Medyman! I really appreciate your great help!~:)
I was following some old tutorial about to make a photo gallery with shooping cart option. Those function are depreciated since I used then before.
basically I want to create a photo gallery with shop cart, so far this is what I got, please see http://1000knots.net/pGallery/.
I would like to have some direction about doing shop cart, I have a button "add to chart" and will save the items and pass to html/php.
Also some formating about the photos, to make them always in center when different size.
Here is the XML loading on the the 1st frame on scene1:
Photo = new XML();
Photo.ignoreWhite = true;
Photo.onLoad = function(success) {
//get the number of images
numimages = this.firstChild.childNodes.length;
spacing = 50;
for (i=0; i<numimages; i++) {
this.picHolder = this.firstChild.childNodes[i];
this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
this.thumbHolder._x = i*spacing;
this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
this.thumbLoader.loadMovie(this.picHolder.attributes.thmb);
this.thumbHolder.title = this.picHolder.attributes.title;
this.thumbHolder.main = this.picHolder.attributes.main;
this.thumbHolder.onRelease = function() {
loader.loadMovie(this.main);
title_txt.text = this.title;
flatout._visible = false;
//trace("test");
};
}
};
Photo.load("xmlphoto.xml");
And the xml file:
<gallery>
<image title="dog dog" main="images/1.jpg" thmb="thumbnails/1.jpg"/>
<image title="car race" main="images/IMG_4931.jpg" thmb="thumbnails/IMG_4931.jpg"/>
<image title="car race" main="images/IMG_2069.jpg" thmb="thumbnails/IMG_2069.jpg"/>
<image title="car race" main="images/IMG_2387.jpg" thmb="thumbnails/IMG_2387.jpg"/>
<image title="car race" main="images/IMG_8608.jpg" thmb="thumbnails/IMG_8608.jpg"/>
<image title="car race" main="images/IMG_8616.jpg" thmb="thumbnails/IMG_8616.jpg"/>
<image title="car race" main="images/IMG_8622.jpg" thmb="thumbnails/IMG_8622.jpg"/>
<image title="car race" main="images/IMG_8631.jpg" thmb="thumbnails/IMG_8631.jpg"/>
<image title="car race" main="images/IMG_8536.jpg" thmb="thumbnails/IMG_8536.jpg"/>
<image title="cherry on tree" main="images/IMG_5566.jpg" thmb="thumbnails/IMG_5566.jpg"/>
<image title="car race" main="images/IMG_1217.jpg" thmb="thumbnails/IMG_1217.jpg"/>
<image title="Hot Chic" main="images/hotchic.jpg" thmb="thumbnails/hotchic.jpg"/>
<image title="car race" main="images/IMG_4931.jpg" thmb="thumbnails/IMG_4931.jpg"/>
<image title="car race" main="images/IMG_2069.jpg" thmb="thumbnails/IMG_2069.jpg"/>
<image title="car race" main="images/IMG_2387.jpg" thmb="thumbnails/IMG_2387.jpg"/>
<image title="car race" main="images/IMG_8608.jpg" thmb="thumbnails/IMG_8608.jpg"/>
<image title="car race" main="images/IMG_8616.jpg" thmb="thumbnails/IMG_8616.jpg"/>
<image title="car race" main="images/IMG_8622.jpg" thmb="thumbnails/IMG_8622.jpg"/>
<image title="car race" main="images/IMG_8631.jpg" thmb="thumbnails/IMG_8631.jpg"/>
<image title="car race" main="images/IMG_8536.jpg" thmb="thumbnails/IMG_8536.jpg"/>
</gallery>
Medyman
07-30-2007, 08:42 PM
I'm not quite sure what you're asking here. Did you have a question about how to do the php interaction with the flash?
Please rephrase :)
xxlfm
07-31-2007, 02:12 AM
sorry about my bad English:rolleyes:
I guess I still not clear about the flow(process) of the shop cart.
When user clicks the thumbnail and then click the "Add to Cart" if they like it. so I will create the array/variables to capture the item, also display some message to tell user the status of shopping cart, then have a "Check Out" button to go to PHP page, where user could delete or change quantities of the items inside cart.
That' what I am thinking.
I will work on that, and will come back with some detail questions.
Thanks again, Mendyman!
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.