I am having an issue with position of a movie on rollover. It positions fine in Flash Player 6, but is not working with Flash Player 5 (which is what my client wants compatability with). Here is the code I am using: on (rollOver) { gotoAndPlay("WorkLife"); //_root.attachMovie("textBox_mc", "textBox",3,{_x:97.9, _y:91}); _root.attachMovie("workLifeDesc_mc", "workLifeDesc",4, {_x:25.9, _y:68}); } on (rollOut) { gotoAndPlay("Empty"); _root.attachMovie("instructions_mc", "instuctions",4 ,{_x:25.9, _y: 19.9}) } In Flash Payer 5, the movie is loading at 0,0 . .. ignoring the x and y positioning i entered. Its fine when I test with Flash Player 6.
It is because you are using the new to Flash 6 initObject feature of attachMovie. Anything in the ,{_x:25.9, _y:68} will not work in Flash Player 5. You need to place the actions on seperate lines for it to work in Flash Player 5, _root.attachMovie("workLifeDesc_mc", "workLifeDesc",4); _root.workLifeDesc._x=25.9; Plus I don't think you can attachMovie directly to the _root in Flash 5. You will need to create a blank movie clip to attach to.
Thank you for your response. I tried the code you suggested, but it did not work. Looks like you are right about not being able to attachMovie directly to root in Flash 5. I am relatively new to actionscripting and have been working primarly in Flash 6. Would you mind explaining how to create an blank movie clip or how I would refer to it to attach the movie clips in Flash 5? And will this create issues with other clips I am attaching to the root (which I will have to use this other method for). Will I be okay attaching to different layers or is there a better way to do it?
[quoted text, click to view] >how to create an blank movie clip or how I would refer to it to attach the movie clips in Flash 5?
You just create a movie clip in the authoring environment but you don't place anything in the clip. Drag the clip from the library to the stage (it will be a small blank circle) and give it an instance name. You use this instance name with the attachmovie action, myClipInstanceName.attachMovie("workLifeDesc_mc", "workLifeDesc",4); Layers don't matter as they are all merged into one when you publish. What matters is the depth you are attaching the movie clip to. Higher depths will be over lower depths and the same depth will replace what is there. You should be able to attach all your clips to the same blank clip if you want.
Clint, Thanks very much for your help. That worked, sort of . . . i have found that my _x and _y coordinates are being ignored and instead, it is the location of the empty_mc on the screen that is determining the _x and _y positions. Here is a sample of my code. Does it look right to you? on (rollOver) { myClipInstance.attachMovie("cardMemDesc_mc", "cardMemDesc",5); myClipInstance.cardMemDesc_mc._x=25.9; myClipInstance.cardMemDesc_mc._y=58; } If code is ok, and there is nothing I can do to control the x/y I can live with it. I am MUCH further along than before thanks to ur clear suggestions.
There are a few ways to control the _x and _y in Flash 5 but none as nice as the initObject of MX. One way is to just move the blank clip to where you want the attached clip to show up. The attached clip will show up where the "main" clip is. This is ok but not very dynamic. You can move the _x and _y of the "main" clip and this should work fine as the clip is attached to it and will follow, myClipInstance.attachMovie("cardMemDesc_mc", "cardMemDesc",5); myClipInstance._x=25.9; You can also use the code you gave but you need to fix it so you use the new instance name not the linkage name you gave the clip in the library. I would also set the blank clip to 0,0 (because the _x and _y will be based on the _x and _y of the "main" clip). on (rollOver) { myClipInstance.attachMovie("cardMemDesc_mc", "cardMemDesc", 5); myClipInstance.cardMemDesc._x = 100; // note using cardMemDesc not the linkage name
Don't see what you're looking for? Try a search.
|