Skip to main content
Known Participant
February 25, 2014
解決済み

How to make an item be remembered once the page is changed?

  • February 25, 2014
  • 返信数 1.
  • 856 ビュー

Hi,

For my school project I am trying to create a drag and drop product on Adobe Flash CS4 using Action Script 3.0.

I have three keyframes:

- The first one has tops to be dragged and dropped onto the model

-The second one has skirts/trousers to be dragged and dropped onto the model

-The third has shoes to be dragged and dropped onto the model

But once the top has been dragged and droped and the next button is selected displaying the skirts/trousers, the top which has been dragged and dropped onto the model is no longer displayed.

Does anyone know what coding I need to add to get each item of clothing to be remembered once it has been dragged and dropped onto the model, so it is visible on the following pages?

Many Thanks

このトピックへの返信は締め切られました。
解決に役立った回答 kglad

extend the layer that includes your tops to your 3rd frame.  in frame 2, assign all the tops' visible property to false except the one dragged onto your model.  likewise for your skirts/trousers.

or you could probably apply e.currentTarget.parent.addChild(e.currentTarget) to the drop listener function when something is dropped on the model.

返信数 1

kglad
Community Expert
kgladCommunity Expert解決!
Community Expert
February 25, 2014

extend the layer that includes your tops to your 3rd frame.  in frame 2, assign all the tops' visible property to false except the one dragged onto your model.  likewise for your skirts/trousers.

or you could probably apply e.currentTarget.parent.addChild(e.currentTarget) to the drop listener function when something is dropped on the model.

Known Participant
February 27, 2014

Thank you very much for your response.

I'm so sorry, this is probably a really silly question but how can I make the items of clothing hidden on the layers where I don't want them seen?

I am also having real problems with my 'next' button in the second key frame.

I am recieving two errors for this button and have tried everything that I can think of, so was wondering if you were able to have a look at my coding for this button and tell me if it is correct bearing in mind that the button is on the second keyframe but should take you to the third.

The first error I am recieving is:

'TypeError: Error #1010: A term is undefined and has no properties'

for the line

'femaleDragAndDropPage.femaleMenu.nextButtonBottoms.addEventListener(MouseEvent.CLICK, onNextButtonBottomsClick);'

-The nextButtonBottoms is the button leading from the second to the third key frame-

The second error I have is:

'TypeError: Error #1034: Type Coercion failed: cannot convert NextButton@246159c1 to PinkNextButton.

at flash.display::MovieClip/gotoAndStop()
at Main/onNextButton3Click()'

for the line

'femaleDragAndDropPage.femaleMenu.gotoAndStop(2);'

-This line is for my next button on the first keyframe which leads to the second one and only appears when it is selected-

On the first keyframe, there is also a next button (with a different instance name) which leads to the second keyframe which works fine so I used the same coding for the next button leading from the second to third keyframe but changed the instance name. This is where I then recieved the errors so cannot view the rest of my pages which come after this one.

Thank ypu so much for your help!

kglad
Community Expert
Community Expert
February 27, 2014

how can I make the items of clothing hidden on the layers where I don't want them seen?

again, assign their visible property to false.  for example, if you want tshirt1 to be invisible, use:

tshirt1.visible=false;

I am also having real problems with my 'next' button in the second key frame. The first error I am recieving is:

'TypeError: Error #1010: A term is undefined and has no properties'

for the line

'femaleDragAndDropPage.femaleMenu.nextButtonBottoms.addEventListener(M ouseEvent.CLICK, onNextButtonBottomsClick);'

-The nextButtonBottoms is the button leading from the second to the third key frame-

either femaleDragAndDropPage or femaleDragAndDropPage.femaleMenu or femaleDragAndDropPage.femaleMenu.nextButtonBottoms don't exist when that code executes.

The second error I have is:

'TypeError: Error #1034: Type Coercion failed: cannot convert NextButton@246159c1 to PinkNextButton.

somewhere (possibly a listener function where you're casting an event's currentTarget) you're trying to coerce NextButton to a PinkNextButton.