A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: The Simple things escape me :(

  1. #1
    Senior Member
    Join Date
    Jan 2003
    Location
    New York/London
    Posts
    367

    The Simple things escape me :(

    I know there must be a simple answer... but I have an swf with banners in it... the user clicks on a banner and a text box shows the code that u can cut and past to show the banner in ur webpage etc...

    this is what i have for the AS...

    Code:
    b1.onPress = function(){
    	myText.text = "<a href='http://www.elinorgeller.com'><img src='http://www.vibetribe.org/elinorgeller/images/links/banner01.jpg' alt='Elinor Geller The Spirit Child' width='468' height='60' border='0' /></a>";
    }
    however... > ' < doesnt work on myspace... only > " <

    is there a way i can type the folling in AS without confusing a text string with in a text string... can > " < be used also as just a text string?

    obviously like this doesnt work >>>
    Code:
    b1.onPress = function(){
    	myText.text = "<a href="http://www.elinorgeller.com"><img src="http://www.vibetribe.org/elinorgeller/images/links/banner01.jpg" alt="Elinor Geller The Spirit Child" width="468" height="60" border="0" /></a>";
    }
    thanks in advance

  2. #2
    Senior Member ninjakannon's Avatar
    Join Date
    Sep 2004
    Posts
    393
    You need to escape the quotation marks with a backslash, try:

    Code:
    b1.onPress = function(){
    	myText.text = "<a href=\"http://www.elinorgeller.com\"><img src=\"http://www.vibetribe.org/elinorgeller/images/links/banner01.jpg\" alt=\"Elinor Geller The Spirit Child\" width=\"468\" height=\"60\" border=\"0\" /></a>";
    }
    The backslashes will not be displayed in your textbox.

    Regards
    Last edited by ninjakannon; 02-15-2007 at 12:49 PM.
    ninjakannon

    - My Website -

  3. #3
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    don't worry its not your fault.......myspace doesn't allow links made in flash but it does allow css and html links the trick is to make your links using css and html so that they just appear to be part of the flash stage....but the css and html links cannot be part of the .swf ! the links must be outside the .swf
    ~calmchess~

  4. #4
    Senior Member
    Join Date
    Jan 2003
    Location
    New York/London
    Posts
    367

    solved it.!!!!

    Code:
    var quote= '"'
    b1.onPress = function(){
    	myText.text = "<a href="+quote+"http://www.elinorgeller.com"+quote+"><img src="+quote+"http://www.vibetribe.org/elinorgeller/images/links/banner01.jpg"+quote+" alt="+quote+"Elinor Geller The Spirit Child"+quote+" width="+quote+"468"+quote+" height="+quote+"60"+quote+" border="+quote+"0"+quote+" /></a>";
    }
    yippy

  5. #5
    Senior Member ninjakannon's Avatar
    Join Date
    Sep 2004
    Posts
    393
    Quote Originally Posted by Avigeller
    Code:
    var quote= '"'
    b1.onPress = function(){
    	myText.text = "<a href="+quote+"http://www.elinorgeller.com"+quote+"><img src="+quote+"http://www.vibetribe.org/elinorgeller/images/links/banner01.jpg"+quote+" alt="+quote+"Elinor Geller The Spirit Child"+quote+" width="+quote+"468"+quote+" height="+quote+"60"+quote+" border="+quote+"0"+quote+" /></a>";
    }
    That would work, however I've given an even simpler solution - read above ^^ :P

    EDIT: Oh, actually your function wouldn't work, Avigeller. You need to either change your quote variable to '_root.quote' and reference it that way or put 'var quote = '"';' inside the b1.onPress function.
    Last edited by ninjakannon; 02-15-2007 at 12:58 PM.
    ninjakannon

    - My Website -

  6. #6
    Senior Member
    Join Date
    Jan 2003
    Location
    New York/London
    Posts
    367
    its been working fine for me.... i use var quote = ' " ' (note the single quotes)

  7. #7
    Senior Member ninjakannon's Avatar
    Join Date
    Sep 2004
    Posts
    393
    Quote Originally Posted by Avigeller
    its been working fine for me.... i use var quote = ' " ' (note the single quotes)
    Yeah, I know it's in single quotes.

    For functions stated like 'myFunction = function () {' you definitely have to put the 'var quote = '"';' inside the function, apparently not for 'object.functionType' functions.

    Anyway, I still recommend escaping the quotes with backslashes - it's the best method of doing this.
    ninjakannon

    - My Website -

  8. #8
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    allright this post is great news !
    ~calmchess~

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