Solved

How do I get the contents of a TileList box that is selected to appear in a MovieClip on the stage?

Posted on 2008-10-23
19
412 Views
Last Modified: 2013-11-11
I currently have a TileList which is populated from an external XML file (works perfectly)

I have a MovieClip which uploads an external SWF into it (works perfectly)

The uploaded SWF has a MovieClip in it which i am using as a place holder for another image which gets uploaded and place inside it. (works perfectly)

I have added googles Drag and Drop code for TileList components to give it a nice play feel, however I wish to be able to drag an image off the TileList and onto this buried MovieClip.

I am completely at a lose on how to call the selecteditem from the tilelist as the code is all in an external as (class), I figured maybe if i can send a variable or trigger a function from the class to a function in the flash file... but nothing i do works.

Even if I can just drag the selecteditem to a non dynamically created movieclip on the stage and have it populate the movieclip on the stage I should be able to continue from there.
0
Comment
Question by:Gavyn_Elrick
  • 12
  • 7
19 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 22794122
Hi, I don't think you can actually drag an item out of a TileList.
are you not happy with simply if the user clicks on one of those images in the TileList, that image gets loaded into the clip in quesiton?
0
 

Author Comment

by:Gavyn_Elrick
ID: 22797160
that would be great if i could get that working i could change it to work with the drag and drop... and you should look up... wait i will send you the link

http://code.google.com/p/as3-drag-and-drop-tilelist/

thats for tilelist drag and drop.

But if you can help me with the click i would be greatful either way
0
 

Author Comment

by:Gavyn_Elrick
ID: 22798086
I have also seen my idea already used sadly... so i know you can do what i am trying to accomplish. I can send you the link as well for that if you'd like to check it out.

P.S. I find with EE it takes forever to solve a problem cause maybe online one message gets replied too a day... is there a time maybe this weekend if possible I can connect online with you... or someone... and throw some ideas against the wall, if anyone has an interest in solving this of course.

Figure I am missing something simple or over looking something... TileList's are the bane of my existence.

I know also that EE would like us to show how we worked out our solution to help others. Well I would be glad to document how we accomplished and add it to this blog for others. But just to speed things up I would like to take it off EE and onto a faster form of communication.
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 22798225
i have no idea how to do the drag and drop with a tile list.
will give it a try and if i find a solution will let you know.
in terms of the other option, simply use an eventlistener to get the clicked on item

off the top of my head the syntax looks something like this (confirm in help file)
tilelist.addEventListener(MouseEvent.Click, blah);
function blah(e:Event) {
trace(e.target.content.selectedItem.label);//or whatever you called it to set the tilelist items.
//use that value to load the selected image into your required target
}


0
 

Author Comment

by:Gavyn_Elrick
ID: 22798635
well ya i know how to use eventlisteners they are swarming through out my program.

but the selectedItem function doesn't work if its not in a class... and if its in a class i can not seem to be able to call the movieclip on the stage. Cause it was created outside the class.
0
 

Author Comment

by:Gavyn_Elrick
ID: 22798644
p.s.

tilelist.addEventListener(MouseEvent.Click, blah);

is actually

tilelist.addEventListener(MouseEvent.CLICK, blah);

it has to be capitalized
0
 

Author Comment

by:Gavyn_Elrick
ID: 22798672
here is the error your code gives me

ReferenceError: Error #1069: Property content not found on fl.controls.listClasses.ImageCell and there is no default value.

which is the same thing when i used it with out content

trace(e.target.selectedItem.label);

ReferenceError: Error #1069: Property selectedItem not found on fl.controls.listClasses.ImageCell and there is no default value.

so ya thats were i am at your almost catching up...

i believe...

e.target.selectedItem.label

can only be called or used inside the class... which as i mentioned... if i do that and then try and even do a call to

trace(stage.castingImage);

which is the name of the movieclip on the stage...

it errors

1119: Access of possibly undefined property castingImage through a reference with static type flash.display:Stage.

were to go from here
0
 

Author Comment

by:Gavyn_Elrick
ID: 22798736
I'm sorry that was wrong of me

trace(stage.castingImage);  isn't corrent

trace(castingImage);   is...

outside the Class... in the FLA.. this is what trace's

[object castingImage_mc_18]

inside the Class of the Tilelist... this is what trace's

1120: Access of undefined property castingImage.

so i am not sure how i can call the movieclip cause the name...

tilelist.selectedItem.label

only works in the class and

i can only call the movieclip (castingImage) in the FLA...

*head is spinning i mustn't be doing something right
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 22802214
i did mine in a simple unnamed package.

whichever class you created your tileList in, that's where you're doign the event listener and getting the image selected yes.
and you should only be listening after your tilelist is populated in order for there not to be the dreaded null reference error.
what is castingImage?

how big are all your packages, zip it up if you can lets have a look.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:Gavyn_Elrick
ID: 22805014
sounds good let me get onto it i need to trim it abit will take me a bit and i will have it upload for you to check out.

Thank you!
0
 

Author Comment

by:Gavyn_Elrick
ID: 22805288
Files that need renaming

castingImage.txt    =    castingImage.swf
dd_tile_list.txt        =    dd_tile_list.as
example.txt           =    example.xml
tilelist.txt                =    tilelist.fla


and all should work as intended so far.

Thanks again for taking a look at this
example-tilelist.zip
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 22810547
ok i've downloaded everything but so far i'm not getting any compile or run time errors though the file is flashing like crazy.
will have a look through the day and get back to you.
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 22812338
i'm missing something. tileList don't load.
0
 

Author Comment

by:Gavyn_Elrick
ID: 22813165
let me review it i am very sorry thought it worked out on my end might have missed something
0
 

Author Comment

by:Gavyn_Elrick
ID: 22813232
hmmm well it runs on my end i will rezi pand upload again... remember you have to have all the renamed files renamed back to the .as .fla .swf .xml that there were ment to be...

lets give it another shot

there are three of the renaming files in the first directory... the last one is buried in the com/jeremyrodgers directory

tilelist-example.zip
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 22813425
cool working now the previous one didn't have anything in the com/jeremyrodger dir.
i'm on it.will let you know.
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 22814023
the drag and drop thing needs to be looked at when i'm a bit more awake.
doing a normal  click and release  i can pull the contents of the item i clicked on.

i.e. images/f13.jpg

but i can't get this to trigger when i stop dragging, so maybe my event listener is conflicting with one of the other ones.
i also can't pull your castingImage movieclip off the stage. Maybe because its not a class that extends a displayObject. and you don't have a document class.
not sure.
when doing the hit test to see if the object was dropped onto the clip i keep getting this. does it mean anything to you?
[object castingImage_mc_1]

so when i drag it anywhere on the stage returns me a true - anywhere off the blue area, returns false.

will look at this drag and drop thing a little closer.
0
 

Author Comment

by:Gavyn_Elrick
ID: 22822740
In reply:

i also can't pull your castingImage movieclip off the stage. Maybe because its not a class that extends a displayObject. and you don't have a document class.

-- I dont understand what your trying to do with this one. The castingImage movieclip is just there to load the external clip into... its sort of a casting couch for those members i wish to change. Its main purpose is to show like i said who customizable members, and you drag an image from the tilelist onto the castingimage which in the end will replace that image then i send that info to my server to save. Which the sending info to the server i have covered... the program is much bigger then this one little file i just removed the rest as it isn't important to my problem at hand.

when doing the hit test to see if the object was dropped onto the clip i keep getting this. does it mean anything to you?

[object castingImage_mc_1]

-- this is a trace(castingImage); statement to show i have mouse_over the buttom right head... all heads are suppose to have this but thats a simple copy and paste once i get this working right.

so when i drag it anywhere on the stage returns me a true - anywhere off the blue area, returns false.

will look at this drag and drop thing a little closer.

thanks again for sticking with me
0
 

Accepted Solution

by:
Gavyn_Elrick earned 0 total points
ID: 22844774
*taps foot

no worries... figured it out myself got it all working just the way i want it!!

I had a class i already had made that creates its own customevents and if i called that in the class file then in the main file i can do a eventlisten for when that customevent triggers and use this to pass info back to the main file and away i go
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now