A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 32

Thread: OnClick image apperance

  1. #1
    Okay, to start off I have a movie with an image as the background. It has a sound when you click on it (a bullet shot sound, to be precise). But now I want, when you click on the image, a image appeareces. I've made a bullet hole image so it looks like your shooting the image! This is a fun game I'm creating, but I don't know how to make the image I created apperear when you click on the background image!
    I've worked out most of the stuff I have to know to finish this movie, but not the image that apperears after you click on the image!
    NOTE: This is not related to any terorists or anything to do with people, it's a game I'm makeing with people as the background from a nother game (Red Faction, to be precise).
    So can someone please help me out here?
    Thank you in advance!
    ASH...

  2. #2
    Senior Member
    Join Date
    Nov 2001
    Posts
    667
    You can do that by duplicating the bulletHole MC every time the mouse is pressed, something like this:
    Code:
    _root.onMouseDown = function() {
    	_root.attachMovie("bulletHole", "bulletHole"+(++name), name);
    	currentHole = "bulletHole"+(name-1);
    	currentHole._x = _root._xmouse;
    	currentHole._y = _root._ymouse;
    }
    In the library, set the "Linkage" property of the MC you want to use as a bulletHole to "export for actionscript" and give it the name "bulletHole" (no quotes).

    You might need to change this line:

    currentHole = "bulletHole"+(name-1);

    to:

    currentHole = eval("bulletHole"+(name-1));

    If it doesnt work.

  3. #3
    problem... the actionscript thingy ain't accsesable!

  4. #4
    Senior Member
    Join Date
    Nov 2001
    Posts
    667
    ... eh wha?

  5. #5

    Here's a screenshot for you!


  6. #6
    sorry i'll upload onto a new server!
    ASH...

  7. #7

    resolved Again... A Screenshot For You!

    [img]http://communities.msn.com/_Secure/0RAD**wcZNF3KruQtIMnoBa8k2PgWaRlhJEbtpyQeFwV9WWoP7 KkSKEttiu*chah8ZppSebHlHCBrVgg8cGyWVqy2NSVW981nvDI YeQUXMeU/flashscreen1.jpg[/img]

  8. #8
    B*U*M*P!

  9. #9
    Be yoU eM Pe

  10. #10
    Senior Member
    Join Date
    Nov 2001
    Posts
    667
    The image needs to be a movie clip.

  11. #11

    thx

    ok thanks!

  12. #12
    ok, who the bullet hole appereses but only in the top left corner! Not where the mouse coursor is

  13. #13
    Senior Member
    Join Date
    Nov 2001
    Posts
    667
    Try chainging the code to:

    Code:
    _root.onMouseDown = function() {
    	_root.attachMovie("bulletHole", "bulletHole"+(++name), name);
    	_root["bulletHole+(name-1)]._x = _root._xmouse;
    	_root["bulletHole+(name-1)]._y = _root._ymouse;
    }

  14. #14
    nope sorry still stays in the corner

  15. #15
    Senior Member
    Join Date
    Nov 2001
    Posts
    667
    Here, try it now, I forgot the closing quotes before.

    Code:
    _root.onMouseDown = function() {
    	_root.attachMovie("bulletHole", "bulletHole"+(++name), name);
    	_root["bulletHole"+(name-1)]._x = _root._xmouse;
    	_root["bulletHole"+(name-1)]._y = _root._ymouse;
    }

  16. #16
    Nope

  17. #17
    Senior Member
    Join Date
    Nov 2001
    Posts
    667
    If this doesnt do it then I dont know what to try. Its 1am here and I cant think right now.
    Code:
    _root.onMouseDown = function() {
    	_root.attachMovie("bulletHole", "bulletHole"+String(++name), name);
    	_root["bulletHole"+String(name)]._x = _root._xmouse;
    	_root["bulletHole"+String(name)]._y = _root._ymouse;
    }

  18. #18
    All that happerns is that the bullet hole appereses in the corner, so which fram am i ment to put it in?

  19. #19
    Does the "_root" command mean anything? or is it just there to look good?

  20. #20
    Nope, still not working

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center