I need to adapt my swf banner so that will work with clickTAG and clickTARGET. Actionscript code is required to be
on (release) {
if (clickTAG.substr(0,5) == "http:") {
getURL(clickTAG, clickTARGET);
}
}
and my HTML code looks like this:
<embed src="banner.swf?clickTAG=http://my-site.com&clickTARGET=_blank" height="250" width="300">
What is wrong?
Actually the wrong thing was that i was using Flash 8, upper code is for Flash from 4 to 7.
Right way to do it in Flash 4, 5, 6 or 7 in ActionScript 2:
on (release) {
if (clickTAG.substr(0,5) == "http:") {
getURL(clickTAG, clickTARGET);
}
}
Right way to do it in Flash 8 or 9 in ActionScript 2
on (release) {
if (_root.clickTAG.substr(0,5) == "http:") {
getURL(_root.clickTAG, _root.clickTARGET);
}
}
The implementation in HTML is following.
With embed tag:
<embed src="path_to_swf.swf?clickTAG=http://website-to-open.com&clickTARGET=_blank" width="300" height="250">
Or with object tag which should be better practice:
<object type="application/x-schockwave-flash" data="path_to_swf.swf" width="300" height="250">
<param name="flashvars" value="clickTAG=http://website-to-open.com&clickTARGET=_blank">
</object>
Target _blank can also be replaced with _self or _top.
Looks like you are using Actionscript 2. Not sure if you meant to;
in Actionscript 3 you might code something like
myButton.addEventListener(MouseEvent.CLICK, go};
function go(event:MouseEvent):void {
if (clickTAG.substr(0,5) == "http:") {
getURL(clickTAG, clickTARGET);
}
)
Related
I am developing an app for Android and IOS.
I have a profile page where the user can change profile pictures. The photo appears in the view and is changed in real time.
My code is like this in the view:
<img alt="logo" style="width:15vh; height:15vh; border-radius: 50%;" src="{{pictureusuariomenu}}">
pictureusuariomenu is a variable found in the controller.
With that variable what I do is, it is the URL of the image that I upload, I update it there. here is the function:
updateStoredImages(name) {
this.storage.get(STORAGE_KEY).then(images => {
let arr = JSON.parse(images);
if (!arr) {
let newImages = [name];
this.storage.set(STORAGE_KEY, JSON.stringify(newImages));
} else {
arr.push(name);
this.storage.set(STORAGE_KEY, JSON.stringify(arr));
}
let filePath = this.file.dataDirectory + name;
let resPath = this.pathForImage(filePath);
// alert(resPath);
this.urlImage=resPath;
let newEntry = {
name: name,
path: resPath,
filePath: filePath
};
this.images=[]; //borrar las imagenes anteriores (no crear la lista de imagenes)
this.images = [newEntry, ...this.images];
this.urlImage = this.images[0].path;
this.colocarImagenEnProfile(this.urlImage);
this.ref.detectChanges(); // trigger change detection cycle
});
}
In this line:
this.colocarImagenEnProfile(this.urlImage);
What I do is:
colocarImagenEnProfile(newFileName){
this.pictureusuariomenu=newFileName;
}
Now in android is working fine this way of updating the profile image in view:
Before:
After:
But in IOS this isn't working. The view is not updated at all
Before:
After:
Nothing appears, just a few letters. But the view doesn't update in IOS.
What could it be?
My specifications:
you forgot to bind it. put it instead of your HTML tag:
<img alt="logo" style="width:15vh; height:15vh; border-radius: 50%;" [src]="pictureusuariomenu">
I don't know why but you have to bind it that way.
also, you have to use window.Ionic.WebView.convertFileSrc(); function, if using angular you need to sanitize it. like this:
this.sanitize.bypassSecurityTrustResourceUrl(window.Ionic.WebView.convertFileSrc(path))
I am adding random get requests to URLs.
foo.com/?boofoo=foo
Can I do this safely? Or is is possible I might break a site by doing this?
You should be fine if you handle the input properly.
So for example with PHP:
<?php
if($_GET['booofooo'] == "value1") {
// do something
} elseif($_GET['booofooo'] == "value2") {
// do something
} elseif($_GET['booofooo'] == "value3") {
// do something
} else {
// error
}
?>
Also, make sure to use escape the data if you're going to put it in your database.
I can't seem to figure out how to programmatically hide or show a setting.
I have tried this:
function onSwitchChange(prefName) {
var ms = require("sdk/simple-prefs").prefs.option1;
if(ms == "S"){
require("sdk/simple-prefs").prefs.option2.hidden = false;
}else{
require("sdk/simple-prefs").prefs.option2.hidden = true;
}
}
require("sdk/simple-prefs").on("option1", onSwitchChange);
you need to give your pref an oninputchanged attribute.
see here: MDN :: Inline Options - Setting element changed notifications
it looks like you're using firefox-addon-sdk so after you make your addon to xpi. rename the xpi to zip then extract it. then edit options.xul then re-zip the files, then re-rename it to .xpi.
the edit you need to make to options.xul is find the setting element of option2. then add to it this:
<setting title="option1" type="string" pref="blahBlahBlah" oninputchanged="if (this.value == 'S') { document.querySelector('setting[title=\"option1\"]').style.display='none'; } else { document.querySelector('setting[title=\"option1\"]').style.display=''; } ">
option2
</setting>
The sitemap is created with DOMDocument and everything works fine. Now I want to create it multilingual. How can I create the xhtml:link element in the following code?
<url>
<loc>http://www.ihremusterdomain.de/english/</loc>
<xhtml:link rel="alternate" hreflang="de" href="http://www.ihremusterdomain.de/deutsch/" />
<lastmod>2014-04-15T16:13:34+02:00</lastmod>
<changefreq>daily</changefreq>
</url>
The other elements like url, loc, lastmod and changefreq yet exist.
In C#, you can do like:
var linkElement = document.CreateElement("xhtml:link", "http://www.w3.org/1999/xhtml");
You need to provide full qualified name along with namespace uri.
Because the node is in the XHTML namespace, you need to use createElementNS to add it:
<?php
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false;
$doc->load('sitemap.xml');
foreach ($doc->getElementsByTagName('loc') as $loc) {
$node = $doc->createElementNS('http://www.w3.org/1999/xhtml', 'xhtml:link');
$node->setAttribute('rel', 'alternate');
$node->setAttribute('hreflang', 'de');
$node->setAttribute('href', str_replace('english', 'deutsch', $loc->textContent));
if ($loc->nextSibling) {
$loc->parentNode->insertBefore($node, $loc->nextSibling);
} else {
$loc->parentNode->appendChild($node);
}
}
$doc->formatOutput = true;
$doc->save('output.xml');
I'm using prestashop and i want to run a/b test. It means you test 2 different templates of your website in the same time as the traffic is redirected 50% to templateA and 50% to templateB.
I have to theme in my folder :
-ThemeA
-ThemeB
To run the test i need to access themeB via a different url form themeA.
So in the folder "/config" i modified the file setting.inc.php like this :
if(isset($_GET['ab']))
{
define('_THEME_NAME_', 'themeB');
}
else{
define('_THEME_NAME_', 'themeA');
}
Now i can reach themeb by typing : www.myshop.com/?ab
My problem is, whenever i click a link, the ?ab parameter is lost and it goes back to template A.
I found someone using another cms that resolved to problem using this code :
`$this->redirect(array('name')); `
But i don't know how to adapt it to prestashop and where should i put it.
Any help would be very appreciated.
Thanks
One quick workaround might be using session, if session is started ([http://sg3.php.net/manual/en/function.session-start.php][1]) before your "theme check".
// Page => watermelons.php
<?php
session_start();
if(isset($_GET['ab']) || isset($_SESSION['ab'])) {
$_SESSION['ab'] = 'themeB';
define('_THEME_NAME_', 'themeB');
} else{
define('_THEME_NAME_', 'themeA');
}
echo _THEME_NAME_;
?>
<br />go to coconuts
// Page => coconuts.php
<?php
session_start();
if(isset($_GET['ab']) || isset($_SESSION['ab'])) {
$_SESSION['ab'] = 'themeB';
define('_THEME_NAME_', 'themeB');
} else{
define('_THEME_NAME_', 'themeA');
}
echo _THEME_NAME_;
?>
<br />go to watermelons